Discussion Locked

Visual Basic Treeview

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am using treeview in Visual Basic

I am trying to determine the code to reference a child of a child of a child.

I have not been able to find a code example.

Thank you.

3 replies

by hurdk

Excellent answer.

Private Sub Form_Load()
' Add items to treeview
TreeView1.Nodes.Add , , "root", "Root Item"
TreeView1.Nodes.Add "root", tvwChild, "child1_root", "Child1 of Root"
TreeView1.Nodes.Add "root", tvwChild, "child2_root", "Child2 of Root"
TreeView1.Nodes.Add "child1_root", tvwChild, "child1_child1", "Child1 of Child1"
TreeView1.Nodes.Add "child1_child1", tvwChild, "child1_child1_child1", "Child1 of Child1 of Child1"
TreeView1.Nodes("child1_child1").EnsureVisible
End Sub

This discussion is closed to new replies.