Show Forms inside a SplitContainer

Hi,

I think this might sound weird, but I’m working with new VS2005 Pro controls.

I have a SplitContainer and I would like to know if there is a way that allows me to show different forms (one at the time) inside my SplitContainer right panel.

My SplitContainer is on a MDI form and instead of showing the form above the SplitContainer, it would be nicer to have it inside the SplitContainer panel.

is it possible any hint

Thanks in advance

George



Answer this question

Show Forms inside a SplitContainer

  • english_d

    George,

    Try Panel1.Controls.Add(New frmClients)

    Here's what I do:

    ' MFBaseForm is a common form others derive from for functionality to talk to the status bar, etc.

    Dim f As MFBaseForm

    f = New MFForm1 ' MFForm1 inherits from MFBaseForm

    AddSubForm(f)

    and so forth for each form

    Private Sub AddSubForm(ByVal f As MFBaseForm)

    f.TopLevel = False

    f.FormBorderStyle = FormBorderStyle.None

    f.Dock = DockStyle.Fill

    f.statusBar = Me.StatusBar1

    Me.Panel1.Controls.Add(f)

    End Sub



  • Yeshia

    Hi Dalej,

    Thanks for your answer, but I got an exception saying that a top level control cannot be added to a control, this is the code:

    Private Sub MainScreenX_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Panel1.Controls.Add(frmClients)

    End Sub

    Any other idea

    Thanks in advance


  • el-chema

    Put a Panel control into the area where you want show the forms.

    Add the forms to the Control collection in the panel.

    Then Show()/Hide() the forms as they are required.



  • Show Forms inside a SplitContainer