First navigate to the form's FormClosing event, and the name of the method to execute before writing off
?
Generally only need to add the following code can be implemented when the form is closed to indicate whether to confirm the exit
Snap form Close event, prompt when closing window
if (MessageBox.Show ("Please confirm whether to exit (y/n)", "System Prompt", Messageboxbuttons.yesno, messageboxicon.information) = = Dialogresult.yes)
{
E.cancel = false;//allowed to exit the system
}
Else
{
E.cancel = true;//prevents the system from exiting
}
?
?
For more instructional videos and downloads, please pay attention to the following information:
My Youku Space:
Http://i.youku.com/acetaohai123
?
My online forum:
http://csrobot.gz01.bdysite.com/
?
Problem Exchange:
qq:910358960
Email:[email protected]
?
C#. NET FAQ-How to catch a closed form event, pop-up window to confirm whether to exit