c# - How to Load next form in MDIparent's panel on clicking button on current loaded form -


i have mdiparent1 form having panel1, form1 having button form1btnnextform , form2 having button form2btnprevform. when mdiparent1 loading, form1 added controls of panel1. want remove form1 , add form2 in controls of panel1 when clicking button form1btnnextform on form1. after adding form2 if button form2btnprevform on form2 clicked form2 removed , form1 again added controls of panel1.

//code mdiparent1  public partial class mdiparent1 : form {     public mdiparent1()     {         initializecomponent();     }      private void mdiparent1_load(object sender, eventargs e)     {         form1 f1 = new form1();         f1.toplevel = false;         f1.dock = dockstyle.fill;         panel1.controls.add(f1);         f1.show();     } }  //code form1  public partial class form1 : form {     public form1()     {         initializecomponent();     }      private void form1btnnextform_click(object sender, eventargs e)     {      }  }  //code form2  public partial class form2 : form {     public form2()     {         initializecomponent();     }      private void form2btnprevform_click(object sender, eventargs e)     {      } }  //code programe  static class program {     /// <summary>     /// main entry point application.     /// </summary>     [stathread]     static void main()     {         application.enablevisualstyles();         application.setcompatibletextrenderingdefault(false);         application.run(new mdiparent1());     } } 

now should write in form1btnnextform_click , form2btnprevform_click.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -