hello all..

i'm new in C# programming. the scenario is i have a datatable is usercontrol and i need to insert row to that datatable on other form, and i need to access the row on that datatable from other form. how can i do that?

thanks in advance..

Recommended Answers

When you create (initialize) your new Form ( if I understand correctly, the one that is going to make changes on the datagrid ), you should pass him a reference to his parent

//Mainform with grid, SettingsBox represent your class
SettingsBox s = new SettingsBox(this);

//in your …
Jump to Post

All 2 Replies

When you create (initialize) your new Form ( if I understand correctly, the one that is going to make changes on the datagrid ), you should pass him a reference to his parent

//Mainform with grid, SettingsBox represent your class
SettingsBox s = new SettingsBox(this);

//in your other class
public SettingsBox(IWin32Window parent)
{
     Form p = (Form)parent;
     //there you go, now you have accesss to your parent form.
}

thanks for your guidance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.