Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

C#
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
       {
           MessageBox.Show ("Closing...");
       }
 
Share this answer
 
C#
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;
      }
}
 
Share this answer
 
Comments
Joezer BH 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900