Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
How to check an item already entered in a listview if i am entering data from a combo box from two tables for an id as value member based on group...I mean there is both software id and asset id that can be added in the listview based on the group software and hardware....If software software item with software id else asset item with asset id will be added to listview....How to check duplicate items while adding to listview if so....
Posted
Updated 13-Apr-13 19:18pm
v4

Wrong approach. Prepare a data set which already does not contains duplicates and populate the control with it. Better yet, think why do you have duplicates in first place and think if you can prevent it. Base all you logic on data, not controls showing data.

—SA
 
Share this answer
 
Comments
Abhinav S 14-Apr-13 2:02am    
5!
Sergey Alexandrovich Kryukov 14-Apr-13 2:47am    
Thank you, Abhinav.
—SA
You can use LINQ to select distinct rows before assigning the source to the listview.
If you are using a sql query to build your source from a database, do the distinct filtering on the query side for enhanced performance.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 14-Apr-13 2:49am    
Agree, a 5.
—SA
Abhinav S 14-Apr-13 2:54am    
Thank you SA.

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