Solved

Early Exit

Posted on 2004-08-16
1
273 Views
Last Modified: 2010-04-15
I am sure this is a simple question that I cannot find the solution to.  I have an application that within a method, it checks a property.  Based on that property I either continue with the application of need to exit the application.  I have tried Application.Exit() and ExitThread(), and each one continues on with the code after the Exit method.  I am needing to halt all code continuation because the application will crash if it does continue.  How can I immediately exit the application without crashing it?????

Thanks,
Kendal
0
Comment
Question by:gvector1
1 Comment
 
LVL 7

Accepted Solution

by:
dttri earned 500 total points
ID: 11812291
 Hello,
  You can use this code:

using System.Diagnostics;

  In an event (for example, button click) try the code below:
  Process myPro;
  myPro = Process.GetCurrentProcess();
  myPro.Kill();
  //another code, these won't execute

  Tri
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

773 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