How would one go about controlling this form element? I would like to prompt the user before closing the application. Also, what about capturing ALT-F4?
Thanks,
Chris
Printable View
How would one go about controlling this form element? I would like to prompt the user before closing the application. Also, what about capturing ALT-F4?
Thanks,
Chris
Override the onclosing method and handle the closing event
VB Code:
Protected Overrides Sub OnClosing(ByVal e As System.ComponentModel.CancelEventArgs) Dim closing As DialogResult = MessageBox.Show("Are you sure you want exit?", "Exit", MessageBoxButtons.YesNo) If (closing = DialogResult.Yes) Then e.Cancel = False Else e.Cancel = True End If End Sub
Thanks. That worked.