How to load child forms in tab control in a MDI form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • milisecond
    New Member
    • Sep 2010
    • 1

    How to load child forms in tab control in a MDI form

    hello , i wana load child forms in a tab control in mdi form when user opens a chil form
  • marcellus7
    New Member
    • Oct 2008
    • 33

    #2
    This is the code in VB .NET, just add a panel to each tabcontrol, and replace childform with the instance of the form you want to display.

    Code:
     	 Panel1.Controls.Clear()
            childForm.FormBorderStyle = FormBorderStyle.None
            childForm.MaximizeBox = False
            childForm.MinimizeBox = False
            childForm.ControlBox = False
            Me.IsMdiContainer = True
            childForm.MdiParent = Me
            childForm.Dock = DockStyle.Fill
            childForm.Parent = Panel1
             childForm.Show()
            Panel1.Update()

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Don't use MDI, just add the Forms as you would a control.
      Be sure to set TopLevel=False on all the child windows.

      Here's the C# version of what I use:
      [code=C#]
      this.IsMdiConta iner = true;

      MyCustomForm myForm = new MyCustomForm();
      myForm.TopLevel = false;
      myForm.Parent = this;
      myForm.Dock = DockStyle.Fill;
      myForm.FormBord erStyle = FormBorderStyle .None;
      TheTabPageToAdd To.Controls.Add (myForm);
      myForm.Show();
      [/code]
      Last edited by Plater; Sep 15 '10, 01:00 PM.

      Comment

      Working...