Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
i want to show the pop up message before closing the screen using c sharp.
 
for that how can i do?
 
please help me.
 
Regards,
Narasiman P.
Posted 11-Feb-13 3:36am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
       {
           MessageBox.Show ("Closing...");
       }
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
       if(MessageBox.Show("Are you sure you want to exit?", "My Application",MessageBoxButtons.YesNo) ==  DialogResult.Yes)
      {
         // Cancel the Closing event from closing the form.
         e.Cancel = true;
      }
}
  Permalink  
Comments
Edo Tzumer at 11-Feb-13 9:17am
   
5+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 240
1 CHill60 205
2 Zoltán Zörgő 175
3 Richard Deeming 170
4 Richard MacCutchan 150
0 Sergey Alexandrovich Kryukov 9,328
1 OriginalGriff 6,806
2 Peter Leow 4,442
3 Zoltán Zörgő 3,984
4 Richard MacCutchan 2,807


Advertise | Privacy | Mobile
Web03 | 2.8.150129.1 | Last Updated 11 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100