in form1 i have datagridview1 in form 2 i have button afer click on button how access that datagridview1
windows form c#
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Gowtham RajamanickamPosted Apr 5, 2015, 11:24 PM
Jiyalal GuptaPosted Mar 27, 2015, 3:27 PM
VulpesPosted Mar 26, 2015, 5:08 PM
You can then access the DataGridView (dataGridView1 say) from Form2 as follows:
// get reference to existing Form1 instance
Form1 f1 = Application.OpenForms["Form1"] as Form1;
// now get reference to dgv
DataGridView dgv = f1.dataGridView1;
// do something with dgv
Jiyalal GuptaPosted Mar 26, 2015, 4:31 PM
Joginder BangerPosted Mar 26, 2015, 4:02 PM
Make the click event on form2 button like this.
Jiyalal GuptaPosted Mar 26, 2015, 2:41 PM
Aditya ChauhanPosted Mar 26, 2015, 2:26 PM
now you can perform which you want