Closing a MDI child form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm working on a MDI application, and I would like to notify the app's main
form when a child form has been closed. What's the best way to do this?

I was thinking about sending a message to the main form via the
System.Windows.Forms.Message class, but I thought I'd see if there's a better
approach first.

Thanks for your help.

Chris
 
I would override the child form's Closed event with a delegate to a local
event handler.

Example:

ChildForm mychild = new ChildForm
mychild.Closed += new System.EventHandler(ChildClosed);

So when the child form closes, it will fire off your local event handler via
the delegate and you can do whatever with it.

Cheers
Shane Sukul
BSC MCSD MCAD
 
Thanks--that worked like a charm and is much cleaner than using Messages
directly.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top