Refresh Parent window after closing child window
Hi,
I have a datagridview in the parent window and by clicking on it, a new window pop ups. After closing the child window, I want to refresh the parent window in order to show the changes. I tried to use the 'activate' event and it is not working. Could any one please help me out!
Re: Refresh Parent window after closing child window
Are you showing the child window using ShowDialog? If so, after the ShowDialog, run your code that updates your DataGridView. Hopefully you have that code in it's own method so you simply add one line of code here.
Re: Refresh Parent window after closing child window
Either what eclipsed said, or handle the child form's Close event.
Re: Refresh Parent window after closing child window
A datasource refresh should do once the child window closes. Most likely after the ShowDialog() call. Or you can also pass the parent window to child window and then update it from there. Else, use delegates and then update what you want in the callback function.
Re: Refresh Parent window after closing child window
Quote:
Originally Posted by
CuteAssistant
Or you can also pass the parent window to child window and then update it from there.
Please don't do that. It is sloppy programming and there is no good reason to code this way.
Re: Refresh Parent window after closing child window
Thank you very much to all...It's working well!