For each MyItem In MyListbox.Items
If MyItem.SomeProperty = SomeValue Then
FoundValue = True;
Exit For
End If
Next MyItem
If FoundValue Then
' Do something
End If
Hi chiph ,sorry that I still new in VB.NET. I dont quite nederstand your coding .
What is Myitem , what is someproperty ? could write the code completely (with declaration)
For example ,I want to search the employee no(textbox) exists in the listbox ? how should i do that ?
What this method does is locate in your ListBox (the MyListBox object) the first string that starts with the supplied string ("Employee 34" in this example -- you'd use a string variable in your actual code).
If it finds a match, iIndex will contain the index of the item. Otherwise it will contain ListBox.NoMatches (a special value supplied by the ListBox class).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.