Click to See Complete Forum and Search --> : How to change the image on a node in a treeview ctrl?


goftnar
October 12th, 2001, 06:40 AM
Hi I would like to know if there is any way to change the image on an node in a treeview.
I have all my images in an imagelist

I would like to have a diffrent image if a parent node contains children node's or not.

I would also like to know if this is possible to do in VBA as well - since I want to use it primery in Access 2000

Thanks in Advance - Goftnar the Swede

Cakkie
October 12th, 2001, 08:22 AM
After populating the treeview, try this:

Dim N as Node

for Each N In TreeView1.Nodes
If N.Children > 0 then
N.Image = "NodeWithChildren"
else
N.Image = "NodeWithoutChildren"
End If
next N



Of course, there must be an image in the associated imagelist that has a key "NodeWithChildren" and one with the key "NodeWithoutChildren"

Tom Cannaerts
slisse@planetinternet.be

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook