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. Is it possible to change order of nodes in treeview?

Is it possible to change order of nodes in treeview?

Scheduled Pinned Locked Moved C#
csharpwinformsquestion
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.
  • C Offline
    C Offline
    chakran
    wrote on last edited by
    #1

    Is it possible to change the order of nodes in treeview control? I wanted to move a node which don't have any child node to one step above. am using c# and winforms dotnetframework is 2.0

    J C 2 Replies Last reply
    0
    • C chakran

      Is it possible to change the order of nodes in treeview control? I wanted to move a node which don't have any child node to one step above. am using c# and winforms dotnetframework is 2.0

      J Offline
      J Offline
      Joe Woodbury
      wrote on last edited by
      #2

      Remove the TreeNode in question from one TreeNodeCollection and put it in another or insert it back into the TreeNodeCollection at a different spot, depending on what "one step above" means. Also look at TreeView.Nodes and TreeNode.Nodes.

      Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

      1 Reply Last reply
      0
      • C chakran

        Is it possible to change the order of nodes in treeview control? I wanted to move a node which don't have any child node to one step above. am using c# and winforms dotnetframework is 2.0

        C Offline
        C Offline
        Corinna John
        wrote on last edited by
        #3

        TreeNode parent = myNode;
        TreeNode child = parent.Nodes[0];

        // remove node
        child.Remove();

        // add it one level above
        parent.Parent.Nodes.Add(child);

        // re-add the former parent node
        child.Nodes.Add(parent);

        This statement is false.

        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