Accessing a treeview image via the "index"

B

Brad Pears

I have a treeview control and am using an associated image control to assign
icons to the parent and child nodes as I add them... In the image control,
you can give each picture a "name". What is the syntax to assign this actual
image "name" to the treeview node instead of the index number it assigns
automatically? The problem I am having is that each time I add or remove an
image, I need to modifiy the code that assigns the picture number to the
node (in the nodes.add code) to the new index number that has been assigned
to that picture - hardly the correct way to do it!!!

Thanks,

Brad
 
G

Graham R Seach

Brad,

The following shows two methods; one using a literal string; the other using
a variable.

Set nod = tvw.Nodes.Add(nodParent, tvwChild, strKey, strText, "myIcon",
strmyIcon)

Information about the Add method can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl198/html/vbmthaddnode.asp

Information about the Treeview control can be found at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cmctl198/html/vbobjtreeview.asp

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

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