Possible Duplicate:
Datagridview, Only show unique values were Duplicate Cell Values C# 2005
I want to know how to find duplicate rows in a datagridview and if exist only update the data.. i need the code to do that I'm working in C# and .NET framework 2.0 VS2005. I'm not using a database is from query from Active Directory and the values continue repeating.
can someone helpme with this...Thanks
try {
You'd need to loop through each row and then through each column. The best way would be to find duplicate before putting them in the
DataGridView
because there is no built-in way to do it with aDataGridView
.Note 1: Your data might have a pattern where you can reduce the number of comparison. This example compare every row against every following rows.
Note 2: If you want to delete duplicates, you should iterate through the rows from the last to the first