Images on Childnodes - Treeview

TryToLearnVB

New member
Joined
Dec 21, 2011
Messages
4
Programming Experience
Beginner
I am trying to figure out how to display different image on childnodes. I've used .Imagekey (after adding images to an ImageList), but it display the images on all the nodes including childnodes and their sub nodes as well. I would like know if there is an way actually to display different images on Parent Nodes, ChildNodes and their sub Nodes.

Thanks,
 
You have to set index or key for each TreeNode, default is index 0 which is first image.
Notice there are two index/key properties for each selected state.
 
Thanks JohnH for reply back. But I am still confused. This how I have coded now!

With

.Nodes.Add("Nodes")
.ImageKey = 0 'set an image to index 0

.Nodes(0).Nodes.Add("ChildNode")
.ImageKey = 1 '?

End With
 
With what? TreeView? That is just setting default index/key for all nodes. Have a look at documentation for TreeNode class.
 
JonhH,

Yes, this is with TreeView. I actually want to use a default image key/index for parent node and different image key/index for childnodes.
 
Back
Top