dcsimg
 

VB Coding Tip: Treeview - The Basics

by Sam Huggill

The basics of using the treeview control.

The basics of using the treeview control.

Private Sub Form_Load() 
'Declare Variables 
Dim mNode As Node 
Dim i As Integer 
'Populate the list box 
List1.AddItem "Node 1" 
List1.AddItem "Node 2" 
List1.AddItem "Node 3" 
'Add the primary node 
Set mNode = Treeview1.Nodes.Add() 
mNode.text = "Primary Node" 
'Add the nodes from the list box 
For i = 0 To List1.ListCount -1 
 Set mNode = Treeview1.Nodes.Add(1, tvwChild) 
 mNode.Text = List1.List(i) 
Next i 
End Sub
This article was originally published on Sunday Nov 17th 2002
Home
Mobile Site | Full Site