vb.net find string in listiview

XK8ER
XK8ER used Ask the Experts™
on
hello there,
I have a listview with ids each line by line..
I would like to know how can I search for an id and select the item..
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013

Commented:
Which ListView Windows or WebForms?
Software Engineer
Top Expert 2011
Commented:
If you are using winforms try the .FindItemWithText method of listview :

myListView.FindItemWithText("text")

http://msdn.microsoft.com/en-us/library/y3h4x385.aspx

Author

Commented:
how can I make the listview not give me an error if the string is not found like


If lstMain.FindItemWithText("32659865").Index <> Nothing Then
            Debug.Print(lstMain.FindItemWithText("32659865").Index)
        End If

Open in new window

Author

Commented:
got it thanks..

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial