-
Hi there,
I have a treeview control with parent and child nodes. When you click the 'Main Menu' (Parent node), 3 child nodes appear as I have in the code below.
I want to have it so that, when one of the child nodes is clicked, a respective textbox will appear on my form (I have all textboxes set to visible=false). Could someone tell me how to do this, please?
Private Sub Form_Load()
Dim ndsnode As Node
' Here your making the first Main Nodes
Set ndsnode = treeview.Nodes.Add(, , "MAIN1", "Main Menu")
' Here you make child nodes under Main1 Node
Set ndsnode = treeview.Nodes.Add("MAIN1", tvwChild, "CHILD1" & A, "Part 1")
Set ndsnode = treeview.Nodes.Add("MAIN1", tvwChild, "CHILD2" & A, "Part 2")
Set ndsnode = treeview.Nodes.Add("MAIN1", tvwChild, "CHILD3" & A, "Part 3")
End Sub
-
Here you go this should hopefully help you,
Code:
Option Explicit
Private Sub Form_Load()
Dim ndsnode As Node
' Here your making the first Main Nodes
Set ndsnode = TreeView.Nodes.Add(, , "MAIN1", "Main Menu")
' Here you make child nodes under Main1 Node
Set ndsnode = TreeView.Nodes.Add("MAIN1", tvwChild, "CHILD1", "Part 1")
Set ndsnode = TreeView.Nodes.Add("MAIN1", tvwChild, "CHILD2", "Part 2")
Set ndsnode = TreeView.Nodes.Add("MAIN1", tvwChild, "CHILD3", "Part 3")
End Sub
Private Sub TreeView_NodeClick(ByVal Node As ComctlLib.Node)
Select Case Node
Case "Part 1"
MsgBox "Node - Part 1 was clicked"
Case "Part 2"
MsgBox "Node - Part 2 was clicked"
Case "Part 3"
MsgBox "Node - Part 3 was clicked"
End Select
End Sub
-
Thanks Desire,
Just what I was looking for!