I have a treeview control that I am loading with data. When opening the form it always expands the second node of the first level. I am confused as why it is doing this.
I want the form to open with all nodes collapsed and the first node having focus (but not expanded).
Can somebody help with where I am going wrong?
I have tried the following code which works on a button to collapse all the nodes but am unsure how to do this on opening the form (have tried the open and load events).
Thanks in advance.
Jonathan
I want the form to open with all nodes collapsed and the first node having focus (but not expanded).
Can somebody help with where I am going wrong?
I have tried the following code which works on a button to collapse all the nodes but am unsure how to do this on opening the form (have tried the open and load events).
Code:
Dim i As Integer
'Purpose Collapse all nodes in the Tree
If tvwTest.Nodes.count > 0 Then
For i = 1 To tvwTest.Nodes.count
tvwTest.Nodes(i).Expanded = False
Next
tvwTest.Nodes(1).Selected = True
End If
Thanks in advance.
Jonathan