Solved TreeView Add Child Nodes before other existing ones

Posted on 2012-08-28
Last Modified: 2012-08-28

I am using the following code to add Child nodes to my TreeView.
I need to insert these before any other existing child nodes.
How do I do this?

 Sub Add_Results_to_Nodes()
        Dim oReviewerID As String = "R"
        For i As Integer = 0 To Me.TreeViewOrg.Nodes.Count - 1
            If Me.TreeViewOrg.Nodes(i).Text = oReviewerID Then
                Dim oNewTreeNode As New TreeNode
                oNewTreeNode.Text = oReviewerID

                oNewTreeNode.ImageUrl = "~/Resources/RedLight.jpg"
            End If
    End Sub
Question by:murbro
    1 Comment

    Accepted Solution

    Me.TreeViewOrg.Nodes(i).ChildNodes.AddAt(0, oNewTreeNode)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    It’s quite interesting for me as I worked with Excel using 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 …
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 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

    20 Experts available now in Live!

    Get 1:1 Help Now