Click here to Skip to main content
11,703,438 members (71,555 online)
Rate this: bad
Please Sign up or sign in to vote.

I Have some Problems to write a code for comparing data of 2 Datagridview

Datagridview 1
Student Name      Class       Feemonth        Amount
ABC                4th        March            1500
XYZ                4th        March            1500

Datagridview 2
Student Name    Class        Grno         Feemonth        Status
ABC              4th         123           
DEF              4th         456 
XYZ              4th         789

I Want to Check Each Row from Datagridview 1 in Datagridview 2 Base on student Name to update Feemonth & status

Please Suggest Me to Write a code for this event using Button Control
Posted 8-Mar-13 20:22pm
Edited 9-Mar-13 11:04am
Maciej Los193.6K
Member 8631057 at 9-Mar-13 2:23am
Help Me PLease
Maciej Los at 9-Mar-13 17:06pm
WinForms? WPF? ASP?
ThePhantomUpvoter at 9-Mar-13 17:09pm
Help with what? How to write a for loop? How to compare values? How to use a button? Where is the code that you have tried?
Nelek at 9-Mar-13 19:46pm
agnesn88 at 13-Mar-13 2:45am
how about :)

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to compare the datagridview cell values

if DGV1.Rows("row index").Cells("# of cell").Value = DGV2.Rows("row index").Cells("# of cell").Value Then
'do this
'do that
End If

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

  Print Answers RSS
0 Maciej Los 540
1 Sergey Alexandrovich Kryukov 400
2 OriginalGriff 340
3 Andy Lanng 124
4 Matt T Heffron 115
0 OriginalGriff 8,519
1 Sergey Alexandrovich Kryukov 7,667
2 CPallini 4,987
3 Maciej Los 4,686
4 Mika Wendelius 3,566

Advertise | Privacy | Mobile
Web04 | 2.8.150819.1 | Last Updated 18 Mar 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100