0

Hello All,

I need to trigger an event on application.exit on windows application (vb.net)....

how could I handle the applicatoin.exit event

4
Contributors
3
Replies
7
Views
8 Years
Discussion Span
Last Post by Praniya
0

I suggest you should handle the Form.Close event, or if you have a quit button on your form, you should handle that button's click event.

0

for example : you have to handle form closing event


Dim ask As String

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
ask = MessageBox.Show("Are You Sure Want To Quit?", "form1", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If ask = MsgBoxResult.No Then
e.Cancel = True
Exit Sub
Else
Application.Exit()
End If
End Sub

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.