static void Main() { ApplicationConfiguration.Initialize(); Application.Run(new Form1()); var form = new Form1(); form.FormClosing += Form_FormClosing; } private static void Form_FormClosing(object? sender, FormClosingEventArgs e) { Application.Run(new Form1()); }