Me.Close

rbharris

Member
Joined
May 26, 2006
Messages
14
Programming Experience
Beginner
My application isn't closing as inteneded. There are a couple of areas in the program that when an exception occurrs I want the program to close. But there is more to it than me.close. The form doesn't actually close unless a certain variable is true.
So
Upon me.close() the Form1_FormClosing event is fired.

VB.NET:
Expand Collapse Copy
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If doCloseApp = False Then
e.Cancel = True
Me.Visible = False
Else
e.Cancel = False   'Here is where I would think the app would terminate
End If
End Sub

During debug I watch it go straight to e.Cancel = False , back the calling sub procedure and it continues to execute the code. I don't understand.
 
Back
Top