Sunday 15 May 2011

How to exit a Windows Forms Application in C# -


I am writing a windows form application in C # which uses only 1 form when I exit the application and I want to close, I have put the code

  lost to private zero () {MessageBox.Show ("bye"); This.Close (); }   

Within class form1: form , which is a form class that was automatically created by Visual Studio. But when this code runs, I get a falling message:

  An unrestricted exception of System.Runtime.InteropServices.ExternalException 'type Additional information in System.Drawing.dll: A normal Error occurred in GDI +   

A picture of the message:

Error Message </ P> <p> What's the problem? </ P> <p> How should I get out of my application? </ P> </ div> <p> <div class =

You need to first quote your string So that the message box will know what to do, and then exit your application to exit the application context.

  Private zero free defeat () {MessageBox.Show ("Bye"); Application.Exit ();}    

No comments:

Post a Comment