I donβt know whether this was really decided or not ... but looking at all the other answers, nothing seems completely clear. The best way I found this is to put the same code that was used to populate your datagridview in the method and pass it to your datagridview form, like this:
public void ConnectAndPopulateDataGridView(DataGridView dataGridView) { }
The code inside the method is exactly the same as the code used to populate the datagirdview initially, except that the name of the datagridview changes to whatever you called in your method.
Now this method is called in your parent form.
The child view is launched through .ShowDialog() , after which the method is called after it is called immediately after the child is closed ... like this:
ChildForm.ShowDialog(); ConnectAndPopulateDataGridView(dataGridView1);
Bragon Mar 24 '16 at 20:34 2016-03-24 20:34
source share