Treeview control - getting childnode values

K

K B

My xml:
<Functions>
<Function Name="F1">
<WI Title=F1-WI1/>
<WI Title=F1-WI2/>
</Function>
<Function Name="F2">
<WI Title=F2-WI1/>
<WI Title=F2-WI2/>
</Function>
</Functions>

My treeview loads perfectly. I can get the <Function> elements using:

Dim stest As String = ""
Dim n As TreeNode
For Each n In tvRoles.Nodes(0).ChildNodes
stest = stest + "; " + (n.ValuePath)
Next

When I change it to Nodes(1).ChildNodes I get an Out of Index, I should
get the <WI> elements, yes?

PLEASE, spent 2 days searching and I'm out of time. I haven't had much
luck at this forum, could someone please tell me if I'm in the wrong
place...and point me in the right direction?

Thanks, Kit
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

K said:
My xml:
<Functions>
<Function Name="F1">
<WI Title=F1-WI1/>
<WI Title=F1-WI2/>
</Function>
<Function Name="F2">
<WI Title=F2-WI1/>
<WI Title=F2-WI2/>
</Function>
</Functions>

My treeview loads perfectly. I can get the <Function> elements using:

Dim stest As String = ""
Dim n As TreeNode
For Each n In tvRoles.Nodes(0).ChildNodes
stest = stest + "; " + (n.ValuePath)
Next

When I change it to Nodes(1).ChildNodes I get an Out of Index, I should
get the <WI> elements, yes?

No. The tvRoles.Nodes property is the collection of Functions nodes. As
there is only one of those, you can not get the second one.
 

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

Members online

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top