On Feb 6, 4:17*pm, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
Hi,
You can make the grid public (not the best option) so that the other form
has access to it.
A better approach though is to make a public method available which in turn
would update the grid (and any other controls in the form)
--
Ignacio Machinhttp://www.laceupsolutions.com
Mobile & warehouse Solutions."SePp" <C_o_z_...@gmx.dewrote in message
news:eb**********************************@k39g2000 hsf.googlegroups.com...
Hi all.
I want to refresh a Datagrid from another form.
For Example I have a Datagrid in that I want to edit data. The user
has the ability to press a button to change these data.
A new Form opens and the user changes the data. After that he saves
the changes and the current form is closing and the old form with the
datagrid gets the focus again.
At the point the user is saving the data I want to refresh the data in
the form with the datagrid.
Could you please tell me a way to do that? Thank you very much.
Kind regards,
SePp- Hide quoted text -
- Show quoted text -
Hm I can't find a way to get it working.
Here an example:
Form1:
Has a combobox I get these data from an OracleDatabase:
something like:
private void load_combobox_1()
{
OracleDataAdapter cmd = new OracleDataAdapter("select *
from ", conn);
cmd.TableMappings.Add("Table", "TABLE1");
DataSet ds = new DataSet("TABLE1");
cmd.Fill(ds);
comboBox_1.DataSource = ds.Tables["TABLE1"];
comboBox_1.ValueMember = "Col1";
comboBox_1.DisplayMember = "col2";
comboBox_1.SelectedIndex = -1;
}
To reload that i have a method:
public void reload_information()
{
load_combobox_1();
}
Now I am opening Form2
Form2 bd = new Form2;
bd.Show();
And atFormClose I want to reload the information in the combobox at
form1:
reload_information();
Here are the way I tried it:
Form1 bd = new Form1()
bd.reload_information();
But this can't work because I generate a new object.
So the big question for me is how do I get the actual Object from
Form1 to reload the information at it.
Something with this. ???
Thank you very much in advance for your information!!!!
Kind regards,
SePp