Expand treeview nodes

S

SamSpade

I want to expand nodes on a treeview. What I have is an array (SubFolder) of
node.text not index.

What I'd like to do is the folowing:

lKey = tvFolders.Nodes(0) ) 'Not in SubFolder

For lLpCnt = 0 To UBound(lSubFolder) - 1

lKey.Expand() 'But do not expand the last node

lKey = lKey.Nodes(SubFolder(lLpCnt))

Next

But Nodes takes an index not the node's text.

I hope I don't have to loop looking for a matched text - Do I?



Thanks in advance
 
H

Herfried K. Wagner [MVP]

* " SamSpade said:
I want to expand nodes on a treeview. What I have is an array (SubFolder) of
node.text not index.

What I'd like to do is the folowing:

lKey = tvFolders.Nodes(0) ) 'Not in SubFolder

For lLpCnt = 0 To UBound(lSubFolder) - 1

lKey.Expand() 'But do not expand the last node

lKey = lKey.Nodes(SubFolder(lLpCnt))

Next

But Nodes takes an index not the node's text.

I hope I don't have to loop looking for a matched text - Do I?

The node's text sometimes isn't unique. What you can do is setting up a
'Hashtable' which stores (text, 'TreeNode') pairs and can be used to
lookup nodes by name.
 

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