VB listbox cannot be indexed because it has no default value
- by Shane Fagan
I have a listbox and I want to loop through each of the items to see if the string im looking for is inside. I know I could do .contains but that wouldnt look at substrings. The code im using looks like this:
While tempInt > Listbox.items.count then
if searchString.contains(listbox(tempInt)) then
end if
tempInt+=1
end while
Everything in the loop is fine but VB gives an error on the listbox(tempInt) part. The error is "class windows.forms.listbox cannot be indexed because it has no default value". Can anyone help get around the default value crap? I tried putting in a blank string but no change.