CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    70

    Child form not showing up in MDIcontainer's split Container

    hi see the code below
    1. i placed form and made it isMDIcontainer=true
    2. added treeview to this form and docked to left
    3. added split Container
    4. added 2 child forms namde Form3 & Form4

    everything ok, except one thing the child forms not showing up
    help me

    Code:
    Public Class Form2
        Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Call FillTreeView()
     End Sub
    
        Private Sub FillTreeView()
            Dim nodX As TreeNode
            Dim nodChild As TreeNode
    
            With tvwMenu
                .BeginUpdate()
    
                'Add the First Parent
                nodX = New TreeNode("Hardcoded elements")
                nodChild = New TreeNode("Child1")
                nodChild.Tag = "Form3"
                nodX.Nodes.Add(nodChild)
                nodChild = New TreeNode("Child2")
                nodChild.Tag = "Form4"
                nodX.Nodes.Add(nodChild)
                .Nodes.Add(nodX)
                nodX = Nothing
    
                'Add the parent for the dynamic elements
                nodX = New TreeNode("Dynamic elements")
                .Nodes.Add(nodX)
                nodX = Nothing
    
                .EndUpdate()
            End With
        End Sub
    
        Private Sub tvwMenu_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tvwMenu.DoubleClick
            Dim temp As String
            Try
                Select Case DirectCast(tvwMenu.SelectedNode.Tag, String)
                    Case String.Empty
                        'Do Nothing
                    Case "Form3"
                        Dim frm As New Form3()
                        temp = frm.Text
                        With frm
                            .MdiParent = Me
                            .FormBorderStyle = FormBorderStyle.None
                            .Show()
                            .Dock = DockStyle.Fill                        
                        End With
                    Case "Form4"
                        Dim frm As New Form4()
                        temp = frm.Text
                        With frm
                            .MdiParent = Me
                            .Show()
                            .Dock = DockStyle.Fill
                        End With
                    Case Else
                        MessageBox.Show("Houston, we have a problem!")
                End Select
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
    
            MessageBox.Show(temp)
        End Sub
    End Class
    Last edited by HanneSThEGreaT; August 21st, 2008 at 02:48 AM. Reason: Added [CODE] [/CODE] Tags!

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Child form not showing up in MDIcontainer's split Container

    Do not use the Splitcontainer here

    Use the Splitter instead.

    On your MDI Parent, remove the Splitcontainer.
    Add the Splitter control ( from All Windows Controls in the Toolbox ), add your Treeview inside that Splitter.
    This will ensure that your Treeview, always occupies the left side of your form, and your child forms will always show on the right.

    I hope you come right

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Child form not showing up in MDIcontainer's split Container

    One more thing, please read this on how to post properly :

    http://www.codeguru.com/forum/showth...07#post1474007

  4. #4
    Join Date
    Aug 2008
    Posts
    70

    Re: Child form not showing up in MDIcontainer's split Container

    Quote Originally Posted by HanneSThEGreaT
    Do not use the Splitcontainer here

    Use the Splitter instead.

    On your MDI Parent, remove the Splitcontainer.
    Add the Splitter control ( from All Windows Controls in the Toolbox ), add your Treeview inside that Splitter.
    This will ensure that your Treeview, always occupies the left side of your form, and your child forms will always show on the right.

    I hope you come right

    thanksm, solved

  5. #5
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Child form not showing up in MDIcontainer's split Container

    That's good news

    Just remember to mark your thread Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured