Click here to Skip to main content
11,926,429 members (60,433 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VS2010 VB.NET

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 21:22pm
Edited 9-Mar-13 12:04pm
Maciej Los210.1K
Member 8631057 9-Mar-13 2:23am
Help Me PLease
Maciej Los 9-Mar-13 17:06pm
WinForms? WPF? ASP?
ThePhantomUpvoter 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 9-Mar-13 19:46pm
agnesn88 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.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