Semantically, you are incorrect, even though in most cases that would work. What you stated will exit the Application Loop that that Application represents. For multiple Application Loops, the must all be terminated.
If you're application consists of of a main form (i.e. one created by using Application.Run(new Form()); ) then closing that form exits the application. Although, if you're doing it programaticly, then I wouldn't use that.
You probably have another thread created that is not running as a background thread which will stop your application from closing until the thread aborts. You probably need to review if this is this case, or upload your project demonstrating the behavior.
Please do not respond to this thread -- create a new one.
Please do not resurrect threads that are years old. By doing so you run the risk of confusing current posters. If you have any questions please ask. You are welcome to start your own threads. Have a look at forum rules.
this.Close() and also this.Dispose() causes an exception.
Then I'd wager you have a problem in your cleanup code. Environment.Exit() probably works because it terminates the process in an unclean way for form applications. I'd further speculate that Application.Exit() fails as well, because it cleanly ends the application.
In other words, your code is broken. Trace the exception and find out where it's coming from, then fix the problem. The closing issue will be resolved as well.
Hello Guys! Please help me out!!!
Curently finishing a small project, when my boss asked that the report should include the person Photo...
CR won't display photo unless it is stored directly into DataBase.
I read some where it is easuer to use Parameter to save both text and image. ...