471,330 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

Refreshing Parent window from child window

I have a Form parent window with a list view on it.
When I click on an item I open another form to edit the details - this
is not and cannot be a dialog window.

When I close the child window I would like the parent window to
automatically refresh by calling a method RefreshData().

How can I achieve this.

Regards
Jeff
Aug 19 '08 #1
2 7007
"Jeff" <jeff@[_nospam_].hardsoft.com.auwrote in message
news:00**********************@news.astraweb.com...
>I have a Form parent window with a list view on it.
When I click on an item I open another form to edit the details - this is
not and cannot be a dialog window.

When I close the child window I would like the parent window to
automatically refresh by calling a method RefreshData().

How can I achieve this.
In the parent form you are probably opening the child form in a way
similar to this:

MyEditForm frm = new MyEditForm();
frm.Show();

In between those lines, you can add an event handler to the form:

frm.Closed += new EventHandler(RefreshData);

This connects your "RefreshData" routine to the Closed event of the
form, so when the form is closed your method will be called as you wanted.
Note that for this to compile, the RefreshData method needs to have the
proper signature for an EventHandler, i.e. void RefreshData(object sender,
EventArgs e).

Aug 19 '08 #2
Thanks Alberto

Its exactly what I needed
Alberto Poblacion wrote:
"Jeff" <jeff@[_nospam_].hardsoft.com.auwrote in message
news:00**********************@news.astraweb.com...
>I have a Form parent window with a list view on it.
When I click on an item I open another form to edit the details - this
is not and cannot be a dialog window.

When I close the child window I would like the parent window to
automatically refresh by calling a method RefreshData().

How can I achieve this.

In the parent form you are probably opening the child form in a way
similar to this:

MyEditForm frm = new MyEditForm();
frm.Show();

In between those lines, you can add an event handler to the form:

frm.Closed += new EventHandler(RefreshData);

This connects your "RefreshData" routine to the Closed event of the
form, so when the form is closed your method will be called as you wanted.
Note that for this to compile, the RefreshData method needs to have
the proper signature for an EventHandler, i.e. void RefreshData(object
sender, EventArgs e).
Aug 19 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Pikolo Mondo | last post: by
3 posts views Thread by Mark | last post: by
1 post views Thread by hashya | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.