Click to See Complete Forum and Search --> : TreeView Control and the Load statement


John G Duffy
March 13th, 2001, 05:05 PM
I have a Treeview populated with various nodes and subnodes. When I try to Clone this Treeview, all the nodes expand. Question is how can I prevent the nodes from expanding? Here is a sample program to reproduce the problem.
Start a new project, Add a Treeview. Set its Index value to 0. Add a command button. Run the program. Click the button and watch the Treeview expand all its nodes.
[vbcode]
Private Sub Command1_Click()

Load TreeView1(1)

End Sub

Private Sub Form_Load()
Dim nodx As Node, nodey As Node
TreeView1(0).Nodes.Add , , "Root", "Root"
TreeView1(0).Nodes(1).Expanded = True
Dim X
For X = 1 To 10
Set nodx = TreeView1(0).Nodes.Add("Root", tvwChild, "A" & X, "Child " & X)
Set nody = TreeView1(0).Nodes.Add(nodx, tvwChild, "B " & (X * X), "B nodes")
TreeView1(0).Nodes.Add nody, tvwChild, "C" & X, "Child C" & X
Next X

End Sub
[/vbcode

John G