c# - Where do I put a piece of code that I want to run right before a multi-form Windows form app exits? (no matter how the program exits) -
I have a C # application that contains multiple versions, and there is no special that will always be closed last
Where should I place a piece of program (i.e. dumping some information in the file) to make sure how any program goes out, before the program closes?
Well, a method to do whatever is right before exiting a main method Have to call.
ETA:
By default, the main method is in the program.cs file.
Here is an example of what I mean
static zero main () {Application.EnableVisualStyles (); Application.SetCompatibleTextRenderingDefault (wrong); Application.Run (New Form 1 ()); // ** This code will not reach when form1 will be closed. Boole blah = true; DoWhatEver (blah); }
Comments
Post a Comment