using listboxes in visual basic 2008 .net

visual basic 2008 , .net , visual studio Pasadena, United States
  • 11 years ago
    If Listbox of products in stock(lstProducts) has the following items A B C D And the user randomly selects items from lstProducts to another listbox(lstAddtoCart) A C How do I display the Items in lstAddtoCart in another listbox? i did something like this: i meant like for instance, you have 2 listboxes, with one containing list of items available in a shop(called lstProducts) and the other containing list of items selected for the sale(called lstAddtoCart).....now if you if you wanna proceed to buying some selected items in lstAddtoCart by clicking the the Proceed button which the displays the all the items that you have selected....... Now my question is how do you get to grad out these selected items using a button Dim count As Integer Dim aitems As String = lstAddtoCart.Text count = lstAddtoCart.Items.Count Dim value As String For x As Integer = 1 To count + 1 Step +1 value = lstAddtoCart.Items(count)(x).ToString Next x If abooks = value Then Listbox3.Text= value End If but i get an error telling me that : InvalidArgument=Value of '1' is not valid for 'index'. Parameter name: index
  • 11 years ago

    I have done something similiar to this... its not that difficult.

    //visual studio 2008 code Put this in the sub for either when lstproducts selected is changed(double click on the list box to make the sub) or for when you click the necessary button. lstAddtoCart.items.add(lstProducts.selecteditem)

    Hope I helped Corey

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Engineers are all basically high-functioning autistics who have no idea how normal people do stuff.” - Cory Doctorow