Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 728
  • Last Modified:

VB.net TreeView Add Child Nodes before other existing ones

Hi

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"
                Me.TreeViewOrg.Nodes(i).ChildNodes.Add(oNewTreeNode)
            End If
        Next
    End Sub
0
Murray Brown
Asked:
Murray Brown
1 Solution
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Me.TreeViewOrg.Nodes(i).ChildNodes.AddAt(0, oNewTreeNode)
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!

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