ubya308
asked on
vb.net Treeview from XML AfterSelect
Hi,
I have an application I am building in Visual Express which contains a treeview that populates from XML. The XML looks something like this
The Treeview is coded to look like the following
+Town
+Street
- John's House
- Jane's House
i.e. the treeview ends at the <House> node and displays the name of the <Name> node.
I want the AfterSelect sub to display the other leaf nodes in that <House> in various text fields.
At the moment what I am trying to do is translate the fullpath attribute of the selected node into the XML path, but I am sure there must be a better way to do this.
How would you do it?
Thanks
Mike
I have an application I am building in Visual Express which contains a treeview that populates from XML. The XML looks something like this
<Town>
<Street>
<House>
<Name>John's House</Name>
<Doornumber>1</Doornumber>
<Owner>John Smith</Owner>
<HasPet>Yes</HasPet>
<LikesGardening>No</LikesGardening>
</House>
<House>
<Name>Jane's House</Name>
<Doornumber>2</Doornumber>
<Owner>Jane Jones</Owner>
<HasPet>No</HasPet>
<LikesGardening>Yes</LikesGardening>
</House>
</Street>
</Town>
The Treeview is coded to look like the following
+Town
+Street
- John's House
- Jane's House
i.e. the treeview ends at the <House> node and displays the name of the <Name> node.
I want the AfterSelect sub to display the other leaf nodes in that <House> in various text fields.
At the moment what I am trying to do is translate the fullpath attribute of the selected node into the XML path, but I am sure there must be a better way to do this.
How would you do it?
Thanks
Mike
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
e.Node.Nodes
and loop through to get all the houses. You can determine if the selected node is a street node by checking the e.Node.Level property.