bassically i want pull the info out the list boxs so i can check if certain stuff has been selected.
ive tryed stuff like.
item = ListBox1.Items.Item(1)
but get this error
InvalidArgument=Value of '1' is not valid for 'index'. Parameter name: index
Printable View
bassically i want pull the info out the list boxs so i can check if certain stuff has been selected.
ive tryed stuff like.
item = ListBox1.Items.Item(1)
but get this error
InvalidArgument=Value of '1' is not valid for 'index'. Parameter name: index
As for all .NET collections, the Items property of the ListBox is zero-based, so the first item is at index 0. If you want to get all items you can use a loop like so:or:vb.net Code:
For Each item As Object In ListBox1.Items MessageBox.Show(item.ToString()) Next Itemvb.net Code:
For index As Integer = 0 To ListBox1.Count - 1 Step 1 MessageBox.Show(ListBox1.Items(index)) Next index
thx, worked a treat :)