Private Sub VisitAllChildNodes(nParent As Node) Dim nChild As Node Set nChild = nParent.Child Do While Not (nChild Is Nothing) List1.AddItem nChild.Text VisitAllChildNodes nChild Set nChild = nChild.Next Loop Set nChild = Nothing End Sub
Sub VisitAll(poNode As Node) List1.AddItem poNode.Text VisitAllChildNodes poNode End Sub
Private Sub Command1_Click() List1.Clear VisitAll TreeView1.SelectedItem End Sub
Private Sub Form_Load() TreeView1.Nodes.Add , , "root", "root" TreeView1.Nodes.Add "root", tvwChild, "a1", "a1"
TreeView1.Nodes.Add "a1", tvwChild, "a1-1", "a1-1" TreeView1.Nodes.Add "a1", tvwChild, "a1-2", "a1-2" TreeView1.Nodes.Add "a1", tvwChild, "a1-3", "a1-3"
TreeView1.Nodes.Add "root", tvwChild, "b1", "b1" TreeView1.Nodes.Add "b1", tvwChild, "b1-1", "b1-1" TreeView1.Nodes.Add "b1", tvwChild, "b1-2", "b1-2"
TreeView1.Nodes.Add "root", tvwChild, "c1", "c1" End Sub |