Tips and tricks for .NET using ASP and VB code.

Verify a form closure with a pop-up window

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If MsgBox("Close Program?", vbYesNo, "Are you sure?") = vbNo Then
e.Cancel = True
Diagnostics.Debug.WriteLine("Attempted program shutdown was thwarted at pop-up window.")
Exit Sub
End If
End Sub

No comments:

Post a Comment

Search This Blog