C
Chris Cairns
I have a MDI Application and would like to prompt the user before exit. I
placed the following in the FormClosing event. It appears to work properly,
however when a user answers no to the question it causes the application to
flash and deactivate. I was able to activate it again but it looks sort of
stupid to have the application flash when it should simply return the user
to the app.
Any ideas around this? I know I can do it easliy with exit on the main menu
but the problem still exists when the user presses the X in the upper corner
thus causing the application.exit.
'Check to see if the user want's to exit before closing the menu.
If MessageBox.Show("Are you sure you want to exit?", "Exit?",
MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly) =
Windows.Forms.DialogResult.No Then
e.Cancel = True
Me.ParentForm.Activate()
End If
placed the following in the FormClosing event. It appears to work properly,
however when a user answers no to the question it causes the application to
flash and deactivate. I was able to activate it again but it looks sort of
stupid to have the application flash when it should simply return the user
to the app.
Any ideas around this? I know I can do it easliy with exit on the main menu
but the problem still exists when the user presses the X in the upper corner
thus causing the application.exit.
'Check to see if the user want's to exit before closing the menu.
If MessageBox.Show("Are you sure you want to exit?", "Exit?",
MessageBoxButtons.YesNo, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly) =
Windows.Forms.DialogResult.No Then
e.Cancel = True
Me.ParentForm.Activate()
End If