Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

vb.net Treeview from XML AfterSelect

Posted on 2014-01-23
2
Medium Priority
?
382 Views
Last Modified: 2014-01-30
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

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

Open in new window


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
0
Comment
Question by:ubya308
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 39805147
I would think that you could get the child nodes for the selected node, and do the processing that you need.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39806176
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

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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question