|
|
#1 |
|
Hyperactive Member
Join Date: Mar 05
Posts: 295
![]() |
I have 2 Listviews, which both contain a list of names. For example :
Listview1 --------- Jon Jim Alan Lee Claire Paul ListView2 --------- Susan James Tony Jon Alan What I'd like to do is compare the two listboxes, and if a name appears in both lists, I'd like to remove it from List2 I have the following code which populates the Listviews, and I assume I need to add something into the For...Next Loop, but I'm not sure what? VB Code:
Can anyone help please ? |
|
|
|
|
|
#2 |
|
PowerPoster
Join Date: Jul 06
Location: Providence, RI - USA
Posts: 7,422
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: [2005] Comparing Two Listviews
What you can do is to check if an item is not in listview1 then add it to listview2
VB Code:
|
|
|
|
|
|
#3 |
|
Moderator.NET
Join Date: Nov 01
Location: NJ - USA (Near NYC)
Posts: 22,482
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: [2005] Comparing Two Listviews
How are you populating your dataset in the first place? you may simply be able to avoid the duplicates by using different SQL syntax if you are pulling this data from a database. That puts the work on the database versus on the windows app, and will likely save time because you dont have to fill up 2 controls and then filter them. You simply only get back the records needed to fill the listviews.
__________________
Using VB.NET 2010/.NET 2.0 through 4.0 * Please mark you thread resolved using the Thread Tools above ![]() PLEASE INDICATE WHAT VERSION OF VB YOU USE!!!!!!!!!!! * If you found a post useful then please Rate it! Code Bank:Manipulate HTML Page content in the Web Browser Control from VB - Drag Drop from Windows into Win Form - Launch new default browser instance to open URL - Display Internet Image in Picturebox - Download Files From Web With Progress Bar - IP Textbox User Control - Installing .NET Framework with INNO Setup ZerosAndTheOne.com -=Matt=- |
|
|
|
|
|
#4 |
|
Hyperactive Member
Join Date: Mar 05
Posts: 295
![]() |
Re: [2005] Comparing Two Listviews
Thanks Stanav and Kleinma for your help - both are excellent suggestions.
I'll go with one of those. Thanks. |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|