Hello All,

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

how could I handle the applicatoin.exit event

Recommended Answers

All 3 Replies

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.

what event do you want?button event?click event?or what?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.