Datagrid update

  • Thread starter Thread starter Sonu
  • Start date Start date
S

Sonu

Hello,
I have a winform1 that contains the Datagrid and in winform2 you can add new
values to the database for datagrid.
I cannot update the datagrid on winform2 close event! All I want is to
update the contents of that datagrid when I close winform2.

Any help would be great.
Thanks
 
You should update the DataGrid in winform1 instead of in winform2.
When you open winform2, you have a reference to it as variable.
So why not create a method or property in winform2 that returns the
new data? And receive it in winform1 to update the DataGrid.

Hope this helps.
 
Sonu,

Are you sure that you have a DataGrid as that is seldom used by people who
have still questions like yours.

The DataGrid can be for a WindowsForm or Webform, however now people use
more the GridView and the DataGridView.

I don't think that it is possible to give you answers are not telling the
problems in a right way.

As you use a DataGrid, then tell which and in this case what version of VB
you are using.

Cor
 
There are many ways to solve your problem , however i will tell you my
vision where it doesn`t mather if you use a datagrid , datagridview or anny
other databound gui control


first of all use databinding with a dataset to your control
I guess you start form 2 from form 1 so just pass the dataset to form 2 ,
add delete or update the values in the dataset and when the form closes you
just perfom a rebind on the datasource
this will show the new data in the databound control on form 1

hth

Michel
 
Back
Top