c# - Close parent window but child window won't be closed -


i want develop windows form application. in parent window button used create , show child window form. when close parent window child window closed automatically. don't want close child window when close parent window. so, want parent window closed child window remain activated.

in parent window:

private void button1_click (object sender, eventargs e) {   childwindow c=new childwindow();   c.show(); } 

then when close parent window child window closed.

hookup method formclosing event of main form. (the 1 want close not cause application exit)

    private void form1_formclosing(object sender, formclosingeventargs e)     {         e.cancel = true;         this.hide();     } 

this cancel closing event, , hide main form. you're going need handle closing down of application though.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -