Hi.
I have 2 forms in my progect.First one contains datagrid.There is a button on the second form. How to update datagrid on the first form by clicking button on the second?
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.
Vimal KandasamyPosted Apr 27, 2009, 1:09 AM
Set your Modifiers property of datagird as public.
and pass your current object of form1 into form2 via an overload constructor.
assign passed object to form2's form1 object.
like
//in form1
Form2 f = new Form2(this);
f.ShowDialog();
//constructor of form2
Form1 form1;
public Form2(Form1 f)
{
InitializeComponent();
this.form1 = f;
}
then in button click
access datagrid like
form1.datagrid
try this.