Reputation: 1
How do I call a method LoadGrid
located in a parent form frmMain
when returning to frmMain
from a child form?
In frmMain
the method LoadGrid
is run at frmMain
load time to populate a data grid view. A stored procedure is used in LoadGrid
to pull the certain (not all) records from SQL data to populate the DGV. Once frmMain is loaded, it is never loaded again, so LoadGrid
is never run again and my DGV is never refreshed.
I have created a button on frmMain
that will run LoadGrid
. It works fine, but this takes manual intervention.
My child form is used to approve/clear records that are shown on the frmMain
DGV. When returning from the child form, I would like the DGV on frmMain
"refreshed", but I don't know how to call LoadGrid
when I return from my child form.
Upvotes: 0
Views: 92
Reputation: 1418
If your child form is modal, you can just call LoadGrid after the call to ShowDialog. Otherwise, handle the child form's Closed event and call LoadGrid in the event handler.
Upvotes: 1