Solved

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

Posted on 2009-04-08
4
828 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now