Application.Exit() ... how do I send a return code upon exit.

Posted on 2006-04-03
Last Modified: 2010-04-16
I am new to C# and I want to:

Create a Windows Forms Application that will send back a return code on exit, so that another application can receive an indication that it ran sucessfully or not.

I am trying to set the exit code before I call application exit, but it does not seem to work ...

System.Environment.ExitCode = 9;

What am I missing?

PS - I am not using a Console application, because I need to invoke a form for the user to interact with.
Question by:mark4262
    LVL 4

    Accepted Solution

    Hrm, If I recall correctly, I think Application.Exit() shuts down the message pump in the current thread, but the application doesn't actually terminate on that line of code.

    So you could probably try:


    Author Comment

    Works Perfectly! ... Thanks a bunch ...

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    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 article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    734 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

    22 Experts available now in Live!

    Get 1:1 Help Now