Strange issue. I kill the main thread, but when the program ends, it still processes the code after this.Close().
Any ideas on how to stop that?
MessageBox.Show("Servers overloaded. Exiting.");
this.Close();
//...other code that processes even after it closes...
Closing the window does not stop the thread.
You can use Environment.Exit to shutdown immediately.
Unlike ASP.Net's Response.End(), calling Close will not abort the thread.
You need to add return; after calling Close() to exit the method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With