|
-
Jan 19th, 2009, 06:40 PM
#1
[RESOLVED] [2005] Avoiding ListView Duplicates
Im adding listviewitems and want to avoid duplication. Now currently, I have resorted to looping through the listview and comparing each items text property against what Im adding. But for a big table this is very slow. The ListView has a .Contains Method but this does not seem to do what I would have assumed; for example
Dim LV As New ListView
Dim I1 As New ListViewItem
I1.Text = "A"
Dim I2 As New ListViewItem
I2 = I1
LV.Items.Add(I1)
'This box will show
If LV.Items.Contains(I1) Then MessageBox.Show("Its present")
'and this box will show
If LV.Items.Contains(I2) Then MessageBox.Show("Its not there")
Is there a way of doing this so I dont have to loop through all the items?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|