How and where can I run the command when the application closes, even if it's debugging?
I need to execute the command in any output, even if the user is a developer and clicks the “stop debugging” button in Visual Studio.
I'm trying with
Application.ApplicationExit += new EventHandler(this.OnApplicationExit);
but that will not work. Maybe I'm wrong or not an event.
I use Winforms, and not, in Form Close there cannot be an event.
I am using Visual Studio 2005 Net Framework 2.0 (as requested by the client), but for information only.
Can I rewrite this ?:
public static void Exit();
source share