Solved

VB.net Add nodes to TreeView node with certain key

Posted on 2012-03-13
3
1,020 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:murbro
3 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 250 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 250 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:murbro
ID: 37716843
thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

757 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now