Add TreeNodes To A TreeView Control

Submitted by:Andery Smith

Date added:26 July, 2011


This snippet shows how to add treenode's to a treeview control. It also shows how to add sub nodes.

Tags: treeview control

Code Snippet:

        Dim Contact1 As TreeNode = TreeView1.Nodes.Add("John Doe")
Dim Contact2 As TreeNode = TreeView1.Nodes.Add("James Carter")
Dim Contact3 As TreeNode = TreeView1.Nodes.Add("Suzan Smith")

Dim email1 As TreeNode = Contact1.Nodes.Add("")
Dim email2 As TreeNode = Contact2.Nodes.Add("")
Dim email3 As TreeNode = Contact3.Nodes.Add("")

Dim number1 As TreeNode = Contact1.Nodes.Add("1234 567 1234")
Dim number2 As TreeNode = Contact2.Nodes.Add("0909 456 1798")
Dim number3 As TreeNode = Contact3.Nodes.Add("9883 672 8738")