|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Prompt User Before Application.Exitplaced 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 Put this and only this in your form closing event.
If MsgBox("Are you sure you want to quit?", MsgBoxStyle.YesNo) = MsgBoxResult.No Then e.Cancel = True Izzy Chris Cairns wrote: Show quoteHide quote > 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
Conversion
DLL created in .NET cannot use? (Inno Setup) Drawing images in different shapes VB.Net Merging Datasets Incorrect behavior of IIf in VB.NET (.NET Framework 1.1 SP1) problem in converting to C# Catch reference error how? Getting error LIBCMT.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in atlmincr database connection Remove x number of charaters from string. Vb.net |
|||||||||||||||||||||||