
Form.Close method does not fire Form_Closing or Form_Closed events
The following code shows 2 msgboxes for me and exits the application.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub Form1_Closed(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Closed
MsgBox("Closed")
End Sub
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
MsgBox("Closing")
End Sub
Quote:
> I have a form with a menuitem the calls Me.Close(). I
> have code in the Form_Closing event to store application
> parameters and then I have code in the Form_Closed event
> that calls Application.Exit().
> I can step through the code in the MenuItem_Click event
> and see that the Me.Close() method is called but niether
> event method seems to be called and the application never
> exits. Any clues as to why?