473,396 Members | 1,940 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 3283

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Richard | last post by:
Hi. I use a ListView to display data in tabular form. Each ListView row corresponds to a data record. The ListView Item of the record is the record key or code. Each SubItem in that row...
1
by: (Pete Cresswell) | last post by:
TabControl on the right side of a form with two tabs: Tab #1 contains two subforms that show some dynamic query results. Tab #2 contains a ListView that gets dynamically populated as the user...
2
by: Chuck | last post by:
The ListViewItem class contains a readonly property called ListView which returns the item's containing ListView object. I have not been able to figure out how this value is set. The...
4
by: hufel | last post by:
Hi, I'm doing my first big project in C# and I'm stuck with a problem that I believe has a simple and efficient solution for it (I just haven't bumped into it yet...). The concept is the...
5
by: ToddH | last post by:
I know the following code is C#. I'm a vb programmer trying to learn a new language. I posted this in the c# group but never got a response. You guys seem to know alot about all languages and have...
2
by: George | last post by:
Hello, I want to update an item in a listview, to perform this I search the items collection to find the item with the corresponding text. Is there a more efficient way to perform this? In a...
21
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each...
2
by: sonali_reddy123 | last post by:
Hi, I have a problem regarding clear method of the listview control. In my application sometimes the "listview1.Items.clear()" method is giving me a "null reference exception". All I could...
2
by: JamesB | last post by:
I have found plenty of details on filling a listview from a dataset, but I need to do the opposite. I have a ListView and I would like to save out the information it contains to xml (or anything...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.