c# - Can I put commands after Form.Close()? -
In C #, suppose I'm in one form, and I pressed a button to close it.
this.Close (); Some_action (); // What can I do ??
Do I close the form or the thread dies and after that everything is lost?
What you are trying to do and depends on the context of the statement. If the form is being shut down, then primarily the owner of the message loop, you can not do any UI related stuff (e.g., you do not display another MessageBox
If you are not doing this with any other window (which is not near the message loop), then you can do anything (even related to the UI) unless you manipulate the closed form object (You will get the ObjectDisposedException
just by any Ta-like object).
By the way, the thread does not die as a result of shutdown
. To close the main window, the message loop ends and not the thread. For example, the following program
Fixed zero main () {Application.Run (new form 1 ()); application. Rouen (new form 2 ()); }
will be closed after
Comments
Post a Comment