How can find a listitem item containing some particular text in VB.NET
-
Hi I want to get an item from listitem containing some particular text. Using "FindItemWithText" we can do but, this will get all the items that contains the particular text. But I want exact search. For ex: The following are the items in listitem: 201, 100, 2, 150 When I search for item "2", I am getting 201 with "FindItemWithText" as 201 contains 2. How can I get the Item "2"? Thanks in advance,
AR Reddy
-
Hi I want to get an item from listitem containing some particular text. Using "FindItemWithText" we can do but, this will get all the items that contains the particular text. But I want exact search. For ex: The following are the items in listitem: 201, 100, 2, 150 When I search for item "2", I am getting 201 with "FindItemWithText" as 201 contains 2. How can I get the Item "2"? Thanks in advance,
AR Reddy
Well, there's no exact match function, so, you can still use that search to return a smaller result set, then do your own string comparison, item-by-item, to find the one that matched exactly. Or, skip searching the ListView and just search the underlying dataset that you used to populate the ListView yourself.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Hi I want to get an item from listitem containing some particular text. Using "FindItemWithText" we can do but, this will get all the items that contains the particular text. But I want exact search. For ex: The following are the items in listitem: 201, 100, 2, 150 When I search for item "2", I am getting 201 with "FindItemWithText" as 201 contains 2. How can I get the Item "2"? Thanks in advance,
AR Reddy
You can add an 'object' to the listview (as well as the combobox). Therefore you can add a key/item pair to the the listview and get the value based on the key. You have to cast the listview.currentitem to the object type (IE: keyvalue pair).
Any suggestions, ideas, or 'constructive criticism' are always welcome. "There's no such thing as a stupid question, only stupid people." - Mr. Garrison