linking an ImageList to a TreeView crashes with "Invalid object"

R

roger

I have a working treeview 6.0 control, in MSA2K7.
Now I want to add icons to it.

I have read that I need an imagelist control, but I get conflicting
instructions about whether to create and populate the imagelist in VB or to
add it to the form in Design View and populate it maunally it through the GUI
(and then link it to the treeview in VB)

I think either will work because I've done both and seem to have a working
imagelist either way. But the VB code halts when I try to link the imagelist
to the treeview.

Me.TreeView1.ImageList = Me.ImageList1

this line crashes with an "Invalid object" error.

But what object is invalid, the treeview or the imagelist?

I notice that I can set every other property of the TreeView control through
the GUI except the .Imagelist property. That seems locked.

I'm confused also because there are so many versions of these Controls out
there, and so many versions of VB (VBA, .Net, Studio)

aha tia
 
M

Maurice

Roger,

You can refer to the imagelist from within the treeview object. When you
look at the properties of the treeview under the general tab you should see
the imagelist option. You can set this to the imagelist if one is placed.

I use this combination all the time and that works as it should. I choose
the latest version of activeX controls which are available to me. So if you
see version 6.0 of both controls use those...

hth
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top