Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7731873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:35:21+00:00 2026-06-01T06:35:21+00:00

How to add a child node to a specific node in treeview? Say I

  • 0

How to add a child node to a specific node in treeview? Say I have “Item1” in treeview already, how do I add “SubItem1” to “Item1” as it’s child node?

I know its probably really simple, but i tried lots of stuff, i just cant get it working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:35:22+00:00Added an answer on June 1, 2026 at 6:35 am

    Adding child node to parent (non-selected)

    First use Find() to get a reference to the parent node. Then add it using the same technique as the other sections below.

    Dim MyNode() As TreeNode 
    MyNode = TreeView1.Nodes.Find("Item1", True)
    MyNode(0).Nodes.Add("SubItem1")
    

    Adding nodes programmatically

    If you want to add the child nodes to a particluar parent node, the idea is to add the child nodes to their parent node by using the parent.node.add() method.
    You can create any number of child like this.

    For example if you want to have a scenario like:

    Grandfather-> Father-> Son

    Then you could do this:

    dim GrandfatherNOde as treenode = tree.nodes.add("Grandfather")
    dim fatherNode as treenode = GrandfatherNode.Nodes.add("Father")
    dim sonNode as treenode = fatherNode.Nodes.add("Son")
    

    More reading/examples

    This page has a good example you can run to dynamically add child nodes to the tree. They do it on a button, which they’ve hooked up like this:

    Private Sub AddChild_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddChild.Click
        TView.SelectedNode.Nodes.Add(Text1.Text)
    End Sub
    

    http://www.codeproject.com/Articles/11830/The-Basic-Operations-on-using-the-TreeView-Control

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: How is possible add child to the specific node how i can
I know that you can use m and then a to add a child
I want to add textbox in treeview as child of one of the parent
I have two validation groups: parent and child I have an add button that
I'm using simpleXML to add in a child node within one of my XML
I would like to add a child, on a very specific place (so I'm
I'm trying to add a child to an XML-node by loading a string as
First of all, I need to Find a parent node by a specific child
Suppose I am using a context menu to add child nodes to a treeview
Lets say I have a Node class as follows: class Node<T> { T data;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.