I,mageList and TreeView

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"
   
End Sub

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)
Why?

Thanks
JAcky
whlukAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TimCotteeHead of Software ServicesCommented:
Add the line
Set TreeView1.ImageList = ImageList1
Before creating the nodes. The Imagelist is not associated with the treeview unless you do it in the treeview properties or in code like this.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
whlukAuthor Commented:
'Invalid object' comes up this time
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.