Now we have a new requirement:
A winform, show a new form, and put your own hide. After the new form is closed, how can we show the parent form? [no more initialization of the parent form can be performed to keep the previous state displayed]
After checking the information, we found that there was a clever way to achieve it by entrusting it. It seems that you only have the entry level.
Public partial class form1: Form <br/>{< br/> Public form1 () <br/>{< br/> initializecomponent (); <br/>}</P> <p> private void button#click (Object sender, eventargs e) <br/>{< br/> This. hide (); <br/> form2 form2 = new form2 (); <br/> form2.show (); <br/> form2.closing + = form2_formclosing; <br/>}</P> <p> private void form2_formclosing (Object sender, formclosingeventargs e) <br/>{< br/> This. show (); <br/>}</P> <p> // note that form2_formclosing of Class B is in Class A </P> <p>/formclosing of Class B events are written in Class, in this way, B can be fully controlled in Class.
Some netizens also proposed another solution:
For example, to create a constructor with parameters, pass the instance of the first form to the previous one.
In form1
New form2 (this). Show ()
Or use a public function. [Well, I only heard about the method, and there is no specific implementation. Study later]