MDI PARENT PROPERTY
-
Hi. im new to c# so pls bear with me and teach me..... i have created an MDI app, so i have three forms. frmMain , frmChild1 and frmChild2. in frmMain i have a button which will call frmChild2.. button click event { frmChild2 c2 = new frmChild2(); this.MdiParent(); c2.Show(); } and in frmChild2 i have a button callin frmChild3(this is also a child of frmMain) button click event { frmChild3 c3 = new frmChild3(); /* how do i assign frmMain as the parent form?... */ c3.Show(); } i also have another problem when i click the button twice, two identical forms pop up...how do i check to see if the form is already open, just direct the user to it and if its closed then open one?... :doh:
-
Hi. im new to c# so pls bear with me and teach me..... i have created an MDI app, so i have three forms. frmMain , frmChild1 and frmChild2. in frmMain i have a button which will call frmChild2.. button click event { frmChild2 c2 = new frmChild2(); this.MdiParent(); c2.Show(); } and in frmChild2 i have a button callin frmChild3(this is also a child of frmMain) button click event { frmChild3 c3 = new frmChild3(); /* how do i assign frmMain as the parent form?... */ c3.Show(); } i also have another problem when i click the button twice, two identical forms pop up...how do i check to see if the form is already open, just direct the user to it and if its closed then open one?... :doh:
At the button click event in form2 use objfrm3=new frm3(); objfrm3.MdiParent=this.MdiParent;//Assigns Parent of frm2 as parent of frm3 objfrm3.Show(); and regarding your problem of multiple forms opening use a counter to count no of instances of form and before instantiating check the value of the counter