0

I have a problem, with a closed form event.
I'd like to make a check with a click on close botton in the title bar that check if the user are sure or not to close the application.
I have made a method that ask if the user are sure when click on the X in the title bar but when the user select the no option what must I do to evitate that the application was closed??

Thanks a lot for the help.

2
Contributors
5
Replies
6
Views
11 Years
Discussion Span
Last Post by campkev
0

could you ask that again in english?

Sorry for my english.
I have made a windows form application.
My application is a Mdicontainer with many child form.
I want to check che closed event of this form, and when happend i want to intercept it and ask a confermation of closing application.
This part I don't have problem to implement.
My problem is the messagebox that ask if the user want really to close (Yes/No).
I have made a method that check if the Dialog result is Yes or no, but when the result it's no, want i can do to stopping the closing operation of the application??

Thanks a lot.

0
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
				if(MessageBox.Show("Are you sure you want to close?", "Closing Program", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
					e.Cancel = true;
			
		}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.