• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

vb.net Treeview from XML AfterSelect


I have an application I am building in Visual Express which contains a treeview that populates from XML. The XML looks something like this

    <Name>John's House</Name>
    <Owner>John Smith</Owner>
    <Name>Jane's House</Name>
    <Owner>Jane Jones</Owner>

Open in new window

The Treeview is coded to look like the following

   - 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?


1 Solution
Bob LearnedCommented:
I would think that you could get the child nodes for the selected node, and do the processing that you need.
Further to TheLearnedOne's comment, AfterSelect event passes you TreeviewEventArgs which you can use to get the list of all child nodes of the selected now


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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now