Solved

Is There an "istruction code" in vb.net to close a console application? (VS2005)

Posted on 2011-03-03
3
301 Views
Last Modified: 2012-05-11
HI,
Is There an "istruction code" in vb.net to close a console application? (VS2005)
because I have not the possibility to terminate the "main function",
because of the thread of my functions

I'm trying with Application.Exit, but I don't know what
references have to add in order to use this object.
0
Comment
Question by:bobdylan75
  • 2
3 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 35024923
Here is how you can end a console application.

using System.Threading;

Process.GetCurrentProcess().Kill(); // Kills this program...
0
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 500 total points
ID: 35024927
Also
System.Environment.Exit(exitCode) - Terminates this process and gives the underlying operating system the specified exit code.  This call requires that you have SecurityPermissionFlag.UnmanagedCode permissions. If you do not, a SecurityException error occurs.  This is the call to use if you are running a console application.

0
 

Author Closing Comment

by:bobdylan75
ID: 35024972
thanky you very much!
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

831 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