Skip to content

Form inheritance

Gene Buryakovsky

Asked Feb 21, 2008, 8:40 AM EST2 answers
Share
LinkedInX

Hi all,

 

          I'm new to this forum. I have three forms, the first one is the base form. The first form opens up a second and the second opens up a third. What I want to do is close the second when the third opens and allow the third to be on top of the first in a .showdialog(this) manner. Any suggestions?

 

Thanks,

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Niradhip Chakraborty
    0

    It can be done easily by following way:

    U please make the firstform is parent form and remaining two form as child form.

    Then u open the 2nd form and before opening the 3rd form from 2nd form add the following code.


                    foreach (Form f in this.MdiChildren)
                    {
                        f.Close();

                    }

    and then open the third form

    like this:

    Code
    frm3 frmopen = new frm3();
                    frmopen.MdiParent = this;
                    frmopen.Show();

    Dnt forget to make the first form as parent form

    0
  • 1 short reply
    • 0
      thank you for the help.
      0