• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 857
  • Last Modified:

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

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
ProWebNetworks
Asked:
ProWebNetworks
  • 2
  • 2
1 Solution
 
jeremymjacksonCommented:
application.close()
0
 
ProWebNetworksAuthor Commented:
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
 
ProWebNetworksAuthor Commented:
System.Environment.Exit(0);



This snippet seems to do the job.
0
 
jeremymjacksonCommented:
Application.Exit(); is the correct syntax.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now