Treeview Index

byoung

Newcomer
Joined
Jan 23, 2003
Messages
9
After I add a Node, whether it is SelectedNode or not, I want to mark that node so I can add children to it.

tvwDemo.SelectedNodes.Nodes.Add("Item To Add")

Once I have done this, how do I get the index or position the node to add a new node to "Item To Add"?

tvwDemo.Nodes("Item To Add").Add("Sub 1")

What is the best way to position adding to the last node in a TreeNode?

Thanks!

Barry
 
The best way to add treenodes is to create the TreeNode object first, then add it to the treeview:

Visual Basic:
Dim t As New TreeNode("text")
TreeView1.Nodes.Add(t)

You can then find out the index of the treenode with the Index property of t.
 
Back
Top