marinajogy
New member
- Joined
- Aug 21, 2008
- Messages
- 1
- Programming Experience
- Beginner
hi see the code below
everything ok, except one thing the child forms not showing up
help me
- i placed form and made it isMDIcontainer=true
- added treeview to this form and docked to left
- added split Container
- added 2 child forms namde Form3 & Form4
everything ok, except one thing the child forms not showing up
help me
VB.NET:
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 a moderator: