Hey guys,
So I have a simple listbox with an add and remove button. After the listbox is populated(maximum of 6 items), I need to do something with each item, but can't seem to get there.
This seems to work pretty well, but if the user has only entered 3 listbox items(which needs to be a possibility) it throws an ArgumentOutOfRange exception.
Need a fix around for this:confused:
So I have a simple listbox with an add and remove button. After the listbox is populated(maximum of 6 items), I need to do something with each item, but can't seem to get there.
Code:
For i As Integer = 0 To lstListBox.Items.Count - 1
strVar1 = CStr(lstListBox.Items(0))
strVar2 = CStr(lstListBox.Items(1))
strVar3 = CStr(lstListBox.Items(2))
strVar4 = CStr(lstListBox.Items(3))
strVar5 = CStr(lstListBox.Items(4))
strVar6 = CStr(lstListBox.Items(5))
Next
Need a fix around for this:confused: