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 Distinguish between row programatically & manually added to DataGridView

Hi

I have two DataGridViews on two different forms. When a row is added manually
to the first DataGridView I need to add it to the second DataGridView.
What event would I use to catch the manual addition of a row so that I can add it to the second DataGridView
ASKER CERTIFIED SOLUTION
Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou
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
the two DatagridViews must be indeticall
SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
The other way is declaring the second form (Form2) as Public in a module
Module Module1
    Public Dgvfrm As Form2
End Module

Open in new window

then ....
Public Class Form1
Private Sub Form1_Load (ByVal sender as System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dgvfrm= New Form2
Dgvfrm.Show()

'Add a Button in Form1 and in the Button Click event add

Dim row0 as string()={"One",Two","Three")
Me.DatagridView1.Rows.Add(row0)
 Dgvfrm.DataGridView1.Rows.Add(row0)
End Sub
End Class

Open in new window

Avatar of Murray Brown

ASKER

Thanks for the help