How to Expand a tree at Run time
Hi,
Here i have a tree view at run time tha works well. On loading the form it shows the tree in the collapsed mode showing only the root. when i load the form i want the form to be completely expanded at all levels.
How can i do this.
Thanks,
Sai Abhiram Bandhakavi
Re: How to Expand a tree at Run time
VB Code:
Option Explicit
Private Sub Form_Load()
Dim i As Integer
TreeView1.LineStyle = tvwRootLines
TreeView1.Sorted = False
TreeView1.Style = tvwTreelinesPlusMinusText
TreeView1.Nodes.Add , , "Main", "Zones"
TreeView1.Nodes.Add "Main", tvwChild, "Zone1", "Zone1"
TreeView1.Nodes.Add "Zone1", tvwChild, "Z1Room1", "Room1"
TreeView1.Nodes.Add "Zone1", tvwChild, "Z1Room2", "Room2"
TreeView1.Nodes.Add "Main", tvwChild, "Zone2", "Zone2"
TreeView1.Nodes.Add "Zone2", tvwChild, "Z2Room1", "Room1"
TreeView1.Nodes.Add "Zone2", tvwChild, "Z2Room2", "Room2"
'Expand the tv:
For i = 1 To TreeView1.Nodes.Count
TreeView1.Nodes.Item(i).Expanded = True
Next
End Sub
:)
[Resolved] How to Expand a tree at Run time