Solved

Early Exit

Posted on 2004-08-16
1
271 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

17 Experts available now in Live!

Get 1:1 Help Now