Update the grid changes from other form
hallo, i am having two forms the first form has grid and other form add new record and update,i want to update the the grid on the main form with changes from other form
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.
Sukesh MarlaPosted Sep 16, 2012, 11:39 AM
public DataTable dtCustomers
{
get
{
return (DataTable)datagridview1.datasource;
}
set
{
datagridview1.datasource=value;
}
}
.
.
.
.
in secondayfrom create a property like this
public MainFrom m
{get;set;}
in Main form when u open seconday from
SecondayFrom f=new SecondayrForm();
f.m=this;
f.show();
Now in seconday from you can access main form..
Simply make changes to m. dtCustomers after save in secondayfrom, it will refresh the grid automatically.
Check this is correct answer if it helped,