Hello,
I want the application to ask me to save my things when I click Exit.
The code works when I click Exit through the Menu, but when I click the red cross, the application just closes without any asking.
How do I get a confirmation on exit through the red cross ?
Code through Menu:
Code:
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Dim response As Microsoft.VisualBasic.MsgBoxResult
response = MsgBox("Save current file?", MsgBoxStyle.YesNoCancel, "Save")
If response = MsgBoxResult.Yes Then
Save()
ElseIf response = MsgBoxResult.No Then
Me.Dispose()
Else
Return
End If
Me.Dispose()
End Sub