vb.net - Visual Basic: How can I get all selected Values from a Listbox (Selectionmode Multisimple) using a Loop? -


I am using a list box in my program that is coupled with a dataset. I now want to select some items in the runtime. I want to get all the values ​​behind those selected items. Value IDs represent the database organizations. I need some SQL queries for them.

So it is that I have already tried:

  Contract = Type = 0 for LISTBox.Items.Count () - 1 if the contractual type listbox. Selected (x) = True then MSBBX (ContactTypelistbox.SelectItems (X) (Contractual Listbox Value Member). If you get  Function  in Android then  

Msbbx using buddy google is really good enough Yes, but only if I select all items in the listbox (starting with the first one) due to an unselected item among them will be System.IndexOfRangeException . The same problem occurs when I do not select the first item in the list, but all others.

Thanks for Plutonics

This is a solution:

  for contract = 1. Choose. Item () - 1 if contractual box. Selected. Calculate ()> 0 Then the next X  
on MSBBC (ContactTypelistBox.Select Items (X) (ContactType Listbox. Value Member)

Comments