
Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/
Why would I have to add a handler? Why doesn't the handler trigger since it
is an event in the form?
Derek Hart
>* "Derek Hart" <dmhart@gte.net> scripsit:
>> I have a main form that is open by using: Application.Run(New
[quoted text clipped - 10 lines]
> Use 'AddHandler' to add a handler to the 'fFormCriteria''s 'Closed'
> event.
"Jeffrey Tan[MSFT]" - 02 Sep 2004 09:19 GMT
Hi Derek,
You may pass the main form's reference to the hidden form, then in the
hidden form(fVersionTimer), add the closing eventhandler for the main form.
Code like this:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim f2 As New Form2(Me)
End Sub
'In Form2, create a new constructor for passing Form1's reference
Dim p As Form1
Public Sub New(ByVal parent As Form1)
MyBase.New()
Me.p = parent
AddHandler Me.p.Closing, AddressOf ParentForm_Closing
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
Private Sub ParentForm_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs)
MessageBox.Show("abc")
End Sub
=======================================
Please apply my suggestion above and let me know if it helps resolve your
problem.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 08 Sep 2004 09:51 GMT
Hi Derek,
Does my reply make sense to you? Is your problem resolved? Please feel free
to tell me. Thanks
Best regards,
Jeffrey Tan
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.