Detect form close event

C

Chris Gilbert

Right, I think that this is a tricky one but I'm hoping someone is
going to tell me it's not.

The application I am writing has a substantial number of forms spread
around various VB.NET dlls. They are displayed within a tab control
on the main form which is in the exe. The opening and closing of
these forms is handled by the main form to enable the tracking of
their status and the creation and deletion of tab pages. When a new
form is opened the type of the form is passed to the main form which
late binds to it (using Activator).

The problem is that say that I have 3 forms open; forms A, B and C.
Forms A and B display information that can be changed in form C but
they are unaware that it exists, A and B may also be in separate
Assemblies. When form C is saved forms A and B need to be made aware
that this has happened so that they can take the necessary action.

There must be a way to do this using events or delegates but I can't
work it out. Maybe form C raises some sort of shared event which A
and B can subscribe to. Can anyone out there help?

Cheers,

Chris
 
B

Bob Powell [MVP]

A good way to do it is to provide an event in the child forms that the
parent can subscribe to.

You can create your own delegate and event, then when the child form is
first created, wire a handler to the event before showing it.

HTH.



--
Bob Powell [MVP]
C#, System.Drawing

ANNOUNCING: Well Formed.
The monthy electronic magazine for
Windows Forms and GDI+ engineers
http://www.bobpowell.net/wellformed.htm

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm
 

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

Top