Click here to Skip to main content
15,124,972 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hello, is there any way to delete duplicates in listview subitems? The one i saw online only remove duplicates from first column. Please, help me out. I am using visual basic
Posted
Comments
   
First of all, why not avoiding duplicates in first place.
Second of all, the whole approach makes no sense. You need to write your own code, not watch how others do it. Don't search for any samples, don't ask pointless questions, just sit down and write code. Nothing else can help you. But if you face some problems down the road, we will gladly help you.
—SA

1 solution

If you're creating a listview by manually adding the listitems, then it's obvious how to selectively remove listitems.

But, as @Sergey Alexandrovich Kryukov points out:
why not avoid duplicates in the first place.

You can modify your query to include rows or exclude them, based on field values. Then pass the resulting object to the listview, eliminating the need to modify the listview any further.

You can also look at the listview class to see what methods are available for deleting a listitem programmatically or referencing them.
   
Comments
Member 10285969 2-Mar-15 17:35pm
   
I do not allow the modification of listview. I just passed the result to the listview but the thing causing this problem is that all the result that should be displayed in the listview is extracted through htmldocument except one of the colums which is populated with a regex expression. So my results is generated at a different time with the result from the regex so thats what is making the duplication. And if i should remove duplicates, only the row with the regex result will be deleted leaving just the top result. Thats why i'm asking or is there a way to avoid writing a repition in each listview column?
Member 10285969 8-Mar-15 6:03am
   
I have seen a way around

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900