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 8761697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:21:01+00:00 2026-06-13T15:21:01+00:00

Is this possible to name the nodes of a Treeview control something like Matrix?

  • 0

Is this possible to name the nodes of a Treeview control something like Matrix?

For Example:

Parent Node
   --> Child Node
       --> Grand child node
Other Parent Node

To (Something like this)

-- Node1
   --> Node11
       --> Node111
       --> Node112
         --> Node1121
   --> Node12
   --> Node13
-- Node2

I am adding the nodes and child nodes by Button click btnAddNode and btnAddChildNode

Now I am just incrementing a counter value which is not catching whether the node is child or parent (just incrementing)

  • 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-13T15:21:03+00:00Added an answer on June 13, 2026 at 3:21 pm

    The simplest solution is using these two simple methods. First is adding TreeNodes to the TreeView control and the second adds the child nodes to the already added nodes.

    public void AddNode(TreeView parent, string text)
    {
        if (parent != null)
        {
             parent.Nodes.Add(new TreeNode(text + (parent.Nodes.Count + 1).ToString()));
        }
    }
    public void AddChildNode(TreeNode parent)
    {
        if(parent != null)
        {
             string number = parent.Text;
             parent.Nodes.Add(new TreeNode(number + (parent.Nodes.Count + 1).ToString()));   
        }
    }
    

    And to check if it’s working you can do something like this:

    AddNode(treeView1, "Node");
    AddNode(treeView1, "Node");
    AddNode(treeView1, "Node");
    AddChildNode(treeView1.Nodes[0]);
    AddChildNode(treeView1.Nodes[0]);
    AddChildNode(treeView1.Nodes[0]);
    AddChildNode(treeView1.Nodes[1]);
    AddChildNode(treeView1.Nodes[2]);
    AddChildNode(treeView1.Nodes[2]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is something like this possible: <form method=post action=myphp.php name=myname target=another_html/iframe_name>??? I want the php
Is this possible to create new {variable = x.something} and specify variable name dynamically?
Is this possible to acces selector with a general tag name. Like in sql
Is it possible for python to accept input like this: Folder name: Download But
Is it possible to pass the coloumn name also like a variable.Please edit this
Possible Duplicate: Concatenate row values T-SQL I have a table like this: ref_num name
I have to do something like this insert into object (name, value, first_node) values
is it possible to find all nodes that don't have a specified child node?
Is it possible to replace a nodes name? Like: HTML: <strong id=element>Text</strong> Javascript: var
Is this possible in javascript? I'm trying to set the property name of an

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.