Link to home
Create AccountLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net Compare columns in two DataGridViews

Hi

I have to write VB.net code to compare two DataGridViews with the same columns.
Each DataGridView has a column called Item_Code and I need to see which item codes in DataGridView1 do not appear in DataGridView2. The initial approach is to loop through the column in DataGridView1 and for each cell then loop through DataGridView2. As there are 1000 rows, this translates to hundreds of thousands if loops. Is there a better way to do this?
Avatar of Ioannis Paraskevopoulos
Ioannis Paraskevopoulos
Flag of Greece image

Hi,

Do you have a DataTable that loads the DataGridView? You can utilize LINQ to do the match. If you provide some more info i can help...

Giannis
ASKER CERTIFIED SOLUTION
Avatar of Ioannis Paraskevopoulos
Ioannis Paraskevopoulos
Flag of Greece image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Murray Brown

ASKER

Thanks for the help