I am trying to set and get the application exit code .
I am trying to do something following :
protected override void OnStartup(StartupEventArgs e)
override the OnExit method, and in the ExitEventArgs you can set that value.
protected override void OnExit(ExitEventArgs e) { e.ApplicationExitCode = your_value; }