Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-04-08
4
Medium Priority
?
848 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
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!
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

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