[RESOLVED] [2005] search an object in a listbox
i have a class "item" and this is how my class looks and how i populate" item"objects my listbox list1
VB Code:
public class item
Public fname As String, pid As Long
Public Sub New(ByVal id As Long, ByVal nm As String)
fname = nm
pid = id
End Sub
Public Overrides Function ToString() As String
Return pid & vbTab & fname
End Function
end class
Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles form1.Load
list1.items.add(new item(1,"myname"))
End Sub
my question is how can i search for a particular object in the list provided my search criteria is the id ???
Re: [2005] search an object in a listbox
Try using FindString but with the number(as string) followed with vbab
VB Code:
'something like this
If List1.FindString("your number" & vbTab) <> -1 Then
'id found
Re: [2005] search an object in a listbox
wa nice!!!! thx!!!!!!!!!!!