Click to See Complete Forum and Search --> : Expand and Collapse TreeView


Off
August 14th, 2001, 02:26 PM
Hi,

I need to know how cani programmatically expand or collapse a treeview.

Thanks in advance

John G Duffy
August 14th, 2001, 08:03 PM
TreeView1.Nodes("NodeKey").Expanded = true
' or
Treeview1.Nodes(3).Expanded = true



You can not expand the entire treeview with one statement. You must expand individual nodes

John G

Iouri
August 15th, 2001, 07:23 AM
'Just addidtion to the John's answer - how to switch between expand/collapse

private Sub Command1_Click()
With TreeView1
.Nodes.Add , , "aaa", "aaa"
.Nodes.Add "aaa", tvwChild, "bbb", "bbb"
.Nodes("aaa").Expanded = true

End With
End Sub

private Sub Command2_Click()
TreeView1.Nodes("aaa").Expanded = Not TreeView1.Nodes("aaa").Expanded


End Sub



Iouri Boutchkine
iouri@hotsheet.com