Click here to Skip to main content
12,698,476 members (23,783 online)
Rate this:
 
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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 11 Feb 2013
Copyright © CodeProject, 1999-2017
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