Click here to Skip to main content
15,311,717 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two datagridviews as 1 and 2, I just need to compare the two datagridviews and remove duplicate values from datagridview 1 with match only 3 columns in two datagridviews (no need to read all the column values in single row, only specific columns to check the duplicate) to see the duplicate. Please support me.
ZurdoDev 17-Nov-14 14:40pm
Where are you stuck?
abdulsafran 17-Nov-14 14:47pm
Hi RyanDev, Thank you for the reply. I could't able to start since I just want to compare 3 columns in both datagridviews and remove need to done in only datagridview 1, I know how to select and remove data, but when it's come to large data, we couldn't able to do it manually, waiting for your support with sample coding.

int n1 = dataGridView2.CurrentCell.RowIndex;
ZurdoDev 17-Nov-14 14:51pm
Don't you just want to loop through the rows and if they don't match, remove them?
abdulsafran 17-Nov-14 14:54pm
RyanDev, Datagridview2 have first column as checkbox and datagridview2 does not have checkbox, other columns are same. So how to match the full row?
ZurdoDev 17-Nov-14 15:00pm
You just have to write code to do it.

Compare each column from each table.
abdulsafran 17-Nov-14 15:05pm
Ok RyanDev, I'll try my best.
Kornfeld Eliyahu Peter 17-Nov-14 14:44pm
What is the source of the data displayed in the DataGridView?
abdulsafran 17-Nov-14 14:50pm
Hi Kornfeld, Thank you for your reply. datagridview1 source from database and datagridview2 is transferred values from datagridview1. Datagridview2 have first column as checkbox and datagridview2 does not have checkbox, other columns are same.
BillWoodruff 17-Nov-14 14:52pm
Is it the case that at some point in time the two DataGridViews were both bound to the same DataSource, and changes in one changed the value in the other ?

I would guess it would be too expensive in terms of computation and memory to operate on only on DataGridView1's DataSource, and then essentially refresh DataGridView1 ?
abdulsafran 17-Nov-14 14:56pm
Hi Bill, thank you for your reply. I couldn't able to get your point.

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