c# - detecting in form1 that form2 is closed -


i trying detect form2 closed in form1. have far

    private void addstagebtn_click(object sender, eventargs e)     {         form2 form2 = new form2();         form2.showdialog();         if (form2.isdisposed)         {             messagebox.show("it closed!");         }     } 

any suggestions? again!

adhere formclosed event of form2.

wherever create do:

form2.formclosed += new formclosedeventhandler(form2_formclosed); 

then create method:

void form2_formclosed(object sender, formclosedeventargs e) {     // whatever want here } 

you'll want use .show() instead of .showdialog() if want able use either form, otherwise form1 unavailable until form2 closed (which assuming not behavior looking for).


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -