Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Check if item exist

Hello, My question is how to see if a item exist in a listview?
And when it exist get the sub column value.


Thanks alot


Dennis
Aren't you doing that backwards? Think of the problem without using any controls.

Use a List to hold all your objects. Create a custom class, if you need to. Then all you need to do is loop through that list for whatever you're looking for.
Code
Dim item as ListviewItem
for each item in Listview1.Items
If (item.SubItems(0).Text).ToString.Equals("name of the item you want to look for") Then  
      MsgBox("item exists")  
      Exit For
      End If  
      Next
if only there was a find method.

[Image: lkEmUec.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by SwaggySwampManAug 17, 2015 08:38 AM 1 146 Aug 17, 2015 08:38 AM
Last Post: Sicarius
[.NET] by SyyKJul 6, 2015 12:53 PM 7 151 Jul 6, 2015 12:53 PM
Last Post: Only3
[C] by midobahrNov 15, 2014 09:47 PM 8 215 Nov 15, 2014 09:47 PM
Last Post: HelloMyNameIsWalter