Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Add child node to treeview node

Add child node to treeview node

Scheduled Pinned Locked Moved C#
helptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KIDYA
    wrote on last edited by
    #1

    Hello Experts!! I am creating treeview at runtime also added node to treeview successfully but i dont know how to add child node to respective same node. Help!!

    B M 2 Replies Last reply
    0
    • K KIDYA

      Hello Experts!! I am creating treeview at runtime also added node to treeview successfully but i dont know how to add child node to respective same node. Help!!

      B Offline
      B Offline
      benjymous
      wrote on last edited by
      #2

      http://lmgtfy.com/?q=c%23+add+child+to+treenode[^] The first result is the MSDN page, which has an example

      Help me! I'm turning into a grapefruit! Buzzwords!

      1 Reply Last reply
      0
      • K KIDYA

        Hello Experts!! I am creating treeview at runtime also added node to treeview successfully but i dont know how to add child node to respective same node. Help!!

        M Offline
        M Offline
        musefan
        wrote on last edited by
        #3

        I would assume you added the first node with...

        TreeView1.Nodes.Add("a node");

        Well, each node also has a collection of nodes so if you store the return value of the above method, or obtain the node with another method search as find then you can add nodes to the collection like...

        TreeNode baseNode = TreeView1.Nodes.Add("Something");
        baseNode.Nodes.Add("My First Child Node");

        Hope that helps :)

        Life goes very fast. Tomorrow, today is already yesterday.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups