?
Solved

VB.net Add nodes to TreeView node with certain key

Posted on 2012-03-13
3
Medium Priority
?
1,204 Views
Last Modified: 2012-03-13
Hi

I have been given a task to load a TreeView in VB.net from three arrays

arrKey, arrDescription, arrParentKey

For each array index I have to add a node with key arrKey and text arrDescription under the node that has a parent node with key arrParentKey

What code would I use?

Thanks
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 37715601
That would be pretty similar to the answer I gave in your other PAQ:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_27625079.html#a37702224
0
 
LVL 17

Assisted Solution

by:nepaluz
nepaluz earned 1000 total points
ID: 37715718
try something like this
        Dim Result = From x In xStringH.Descendants() Where Not String.IsNullOrEmpty(x.@key)
                    Let xNod = New TreeNode Select New With {.xKey = x.@key,
                                     .xParent = x.Name.LocalName,
                                     .xDescription = x...<DESCRIPTION>.Value}
        Dim xTree As New TreeView

        For Each x In Result
            Dim xNod As TreeNode = New TreeNode() With {.Name = x.xKey, .Text = x.xKey}
            xNod.Nodes.AddRange({New TreeNode With {.Name = x.xParent, .Text = x.xParent}, New TreeNode With {.Name = x.xDescription, .Text = x.xDescription}})
            xTree.Nodes.Add(xNod)
        Next

Open in new window

to get
result
0
 

Author Closing Comment

by:Murray Brown
ID: 37716843
thanks
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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

762 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