CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  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!

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