Get only child nodes?

S

Satish

Hi all:

I am using a treeview control to display data that I have on a
spreadsheet. I looked around the internet for a solution to a problem
that I am facing, but could not find the answer that I want...

Is there any way I can get only the child nodes of a selected parent
node in a Treeview control in the order they are in the treeview?

I know there are many posts and solutions giving how to get the child
nodes, but somehow the logic always returns all the nodes at the
selected level too... for ex.

MSoffice:
+ Word
- Excel
- workbook
- worksheet
- VBA
- Temp
+ Powerpoint
+ Access

Here, if I select the node "Excel", I only want the child nodes of
Excel and any other child nodes of Excel's children. (hope this makes
sense). In short, I want workbook, worksheet, VBA and Temp (In this
order only). The solutions offered always return Powerpoint and Access
also. I dont want those.

I am not able to determine as to what condition I should check for so
that my program will filter out the unwanted nodes....probably it is
getting complex because all solutions use recursive calls.

If anyone can help, I will post the code that I currently have.

Thanks!
Satish
 
W

wisccal

I'm not sure if this helps you, but theoretically what you want to do
is something like this:

Public Sub printChildNodes(ByVal n As Node) ' n is selected node
For Each Node in n.getChildNodes()
If Node.hasChildren() Then
printChildNodes(Node)
Else
Debug.Print Node
End If
Next Node
End Sub

Regards,
Steve
 
S

Satish

you are right...thanks for replying.

I figured it out...i was going wrong with my logic... :s

thnx
Satish
 

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