This example adds several images to a ListImages collection, and then uses the images in a TreeView control. To try the example, place ImageList and TreeView controls on a form, and paste the code into the form's Declarations section. Run the example to see the TreeView populated with pictures from the ImageList.
Private Sub Form_Load()
Dim imgX As ListImage
' Load three icons into the ImageList control's collection.
Set imgX = ImageList1.ListImages. _
Add(,"rocket", LoadPicture("icons\industry\rocket.ico"))
Set imgX = ImageList1.ListImages. _
Add(,"plane",LoadPicture("icons\industry\plane.ico"))
Set imgX = ImageList1.ListImages. _
Add(,"car",LoadPicture("icons\industry\cars.ico"))
' Set TreeView control's ImageList property.
Set TreeView1.ImageList = ImageList1
' Create a Treeview, and use ListImage objects for its images.
Dim nodX As Node
Set nodX = TreeView1.Nodes.Add(,,,"Rocket")
nodX.Image = 1 ' Use the Index property of image 1.
Set nodX = TreeView1.Nodes.Add(,,,"Plane")
nodX.Image = "plane" ' Use the Key property of image 2.
Set nodX = TreeView1.Nodes.Add(,,,"Car")
nodX.Image = "car" ' Use the Key property of image 3.
End Sub