PC Review


Reply
Thread Tools Rate Thread

Detect form close event

 
 
Chris Gilbert
Guest
Posts: n/a
 
      12th Aug 2003
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
 
Reply With Quote
 
 
 
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      12th Aug 2003
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


"Chris Gilbert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form.Closing event not fired always when i call Form.Close method berylwilson Microsoft Dot NET Framework Forms 1 20th Apr 2007 02:11 AM
Detect a form closing from the Close button Donald Sy Microsoft Access Forms 1 14th May 2005 03:43 AM
Detect from what form an event fired fabrizio Microsoft Dot NET Framework Forms 3 4th Mar 2004 12:31 PM
How can i detect form minimized event. Suhail Salman Microsoft Dot NET Framework Forms 2 30th Sep 2003 11:33 AM
how to detect Browser close event. sm mehta Microsoft ASP .NET 4 29th Jul 2003 08:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:42 AM.