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 
after (using a newly created message loop). This proves that thread is not dead.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -