Solved

Early Exit

Posted on 2004-08-16
1
272 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 Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

895 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

14 Experts available now in Live!

Get 1:1 Help Now