C#C
C#9mo ago
Fumetsu

Handle Closing Form?

Hello, I'm having some trouble handling the closing of my form. Currently I'm using the method below, but it for some reason runs 5 times instead of just once.
private bool Closing = false;
Classes Classes = new Classes();

public MainForm()
{
    InitializeComponent();
    Application.ApplicationExit += new EventHandler(this.Application_ApplicationExit);
}


private void Application_ApplicationExit(object? sender, EventArgs e)
{
   Classes.Spark.DebugLog("The app is currently being closed!");
}
Was this page helpful?