471,624 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

What good is ListView Contains method

Consider the following where I generate 2 identical ListViewItems, add one
to the ListView and then check to see if the other one is Contained?

I get the MM message but not the WW message.

So Contains only checks to see if the identical Item has been add (I.E., not
an Item with the same data)

I need a method to insure that an item with duplicate data is not added to
the ListView.

Two question:

1) How to avoid dups

2)What good is Contains?

Thanks in advance

PS

Or a third question: Is there an error in what I just said?

Dim zz1 As New ListViewItem(Path.GetFileName(FileOrFolder),
GetImageListIndex(Path.GetFullPath(FileOrFolder), Library.Shell.SHGFI_ICON
Or Shell.SHGFI_SMALLICON))

Dim zz2 As New ListViewItem(Path.GetFileName(FileOrFolder),
GetImageListIndex(Path.GetFullPath(FileOrFolder), Library.Shell.SHGFI_ICON
Or Shell.SHGFI_SMALLICON))

lLVI = ListViewFiles.Items.Add(zz1)

If ListViewFiles.Items.Contains(zz1) Then

MessageBox.Show("MM")

End If

If ListViewFiles.Items.Contains(zz2) Then

MessageBox.Show("WW")

End If
Nov 21 '05 #1
0 3125

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by (Pete Cresswell) | last post: by
2 posts views Thread by Chuck | last post: by
5 posts views Thread by ToddH | last post: by
2 posts views Thread by George | last post: by
2 posts views Thread by sonali_reddy123 | last post: by
2 posts views Thread by JamesB | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.