March 4, 2021
Hot Topics:

VB Coding Tip: Treeview - The Basics

  • By Sam Huggill
  • Send Email »
  • More Articles »

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 November 17, 2002

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date