The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

ExitEventArgs.ApplicationExitCode Property

Gets or sets the exit code that an application returns to the operating system when the application exits.

Namespace: System.Windows
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

public int ApplicationExitCode { get; set; }
/** @property */
public int get_ApplicationExitCode ()

/** @property */
public void set_ApplicationExitCode (int value)

public function get ApplicationExitCode () : int

public function set ApplicationExitCode (value : int)

Members of this class are either not typically used in XAML, or cannot be used in XAML.

Property Value

The exit code that an application returns to the operating system when the application exits.

An application typically returns an exit code to the operating system to indicate whether an application exited successfully or not. An application exit code value of 0 (the default) is commonly used to indicate success. However, you are free to return exit code values that are appropriate to your application.

You can specify an exit code by handling the Exit event and setting ApplicationExitCode with an appropriate value.


You can also specify an exit code by calling Shutdown method. If you do, the value of ApplicationExitCode is the value of the exit code that you pass to Shutdown.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.