I,mageList and TreeView
Posted on 1999-11-03
I got a simple but nasty problem for your!
I'm using VB5.0 and I got a Treeview in which I want to add an image to all of the nodes. so I add an imagelist to the program. But i can't see the imagelist1 under (general)... (i don't know what the (Edited by Copmuter101) is called). I follow a book for the code following:
Private Sub Form_Load()
Dim Node1 As Node
Dim Node2 As Node
Dim Node3 As Node
Set Node1 = TreeView1.Nodes.Add
TreeView1.Nodes(1).Text = "Node 1"
TreeView1.Nodes(1).Key = "Node 1"
TreeView1.Nodes(1).Image = "closed"
Set Node2 = TreeView1.Nodes.Add("Node 1", tvwChild, "Node 2")
TreeView1.Nodes(2).Text = "Node 2"
TreeView1.Nodes(2).Key = "Node 2"
TreeView1.Nodes(2).Image = "leaf"
Set Node3 = TreeView1.Nodes.Add("Node 1", tvwChild, "Node 3")
TreeView1.Nodes(3).Text = "Node 3"
TreeView1.Nodes(3).Key = "Node 3"
TreeView1.Nodes(3).Image = "leaf"
I have initialised the imagelist by right clicking on the imagelist object and choosing properties. I key in the key with leaf and closed.
I insert the pictures in the directory
d:\program files\microsoft visual studio\common\graphics\bitmaps\outline\closed.bmp and leaf.bmp
But it is always back with the error saying that my imagelist hasn't been initialised (err code: 35613)