Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Application Exit? End? Quit? How to?? C#

Posted on 2009-04-08
4
Medium Priority
?
854 Views
Last Modified: 2012-05-06
Application: C# Multiform Windows Application

I have an app that I will have a button for "Logout" that will run a series of code, and then is supposed to end the program. What code can I use that quickly terminates the application?

In Visual Basic I used:

End


Thanks.
0
Comment
Question by:ProWebNetworks
  • 2
  • 2
4 Comments
 

Expert Comment

by:jeremymjackson
ID: 24098552
application.close()
0
 
LVL 1

Author Comment

by:ProWebNetworks
ID: 24098605
Application.Close() gives error:
System.Windows.Forms.Application does not contain a definition for 'close'



I was thinking maybe:
System.Environment.Exit(0);




---I am going to test this now.
0
 
LVL 1

Accepted Solution

by:
ProWebNetworks earned 0 total points
ID: 24098627
System.Environment.Exit(0);



This snippet seems to do the job.
0
 

Expert Comment

by:jeremymjackson
ID: 24098752
Application.Exit(); is the correct syntax.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question