Closed event of a form

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2005
Posts: 20
Reputation: lorf14plus is an unknown quantity at this point 
Solved Threads: 1
lorf14plus lorf14plus is offline Offline
Newbie Poster

Closed event of a form

 
0
  #1
Feb 15th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Closed event of a form

 
0
  #2
Feb 15th, 2006
could you ask that again in english?
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 20
Reputation: lorf14plus is an unknown quantity at this point 
Solved Threads: 1
lorf14plus lorf14plus is offline Offline
Newbie Poster

Re: Closed event of a form

 
0
  #3
Feb 16th, 2006
Originally Posted by campkev
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Closed event of a form

 
0
  #4
Feb 16th, 2006
  1. private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
  2. {
  3. if(MessageBox.Show("Are you sure you want to close?", "Closing Program", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  4. e.Cancel = true;
  5.  
  6. }
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 20
Reputation: lorf14plus is an unknown quantity at this point 
Solved Threads: 1
lorf14plus lorf14plus is offline Offline
Newbie Poster

Re: Closed event of a form

 
0
  #5
Feb 17th, 2006
Thanks a lot for your help.

I have prove it and this work perfectly.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 483
Reputation: campkev is an unknown quantity at this point 
Solved Threads: 19
campkev campkev is offline Offline
Posting Pro in Training

Re: Closed event of a form

 
0
  #6
Feb 17th, 2006
de nada
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC