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. Help! I can't get it to work!!!!

Help! I can't get it to work!!!!

Scheduled Pinned Locked Moved C#
questionhelp
4 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.
  • J Offline
    J Offline
    JstDaNuGuy
    wrote on last edited by
    #1

    how can i sort treenodes in my treeView by similar text? NOT tView.Sorted = true, but by actually removing the duplicate nodes and adding their children to the 'new' parent node. Current: +node1 +node2 +node2 +node2 +node2 +node3 +node3 +node4 +node4 +node5 Desired: +node1 node2    |_subnode1    |_subnode2    |_subnode3 node3    |_subnode1 +node4 +node5 :-D :laugh: ;p :^) :sigh:

    L I 2 Replies Last reply
    0
    • J JstDaNuGuy

      how can i sort treenodes in my treeView by similar text? NOT tView.Sorted = true, but by actually removing the duplicate nodes and adding their children to the 'new' parent node. Current: +node1 +node2 +node2 +node2 +node2 +node3 +node3 +node4 +node4 +node5 Desired: +node1 node2    |_subnode1    |_subnode2    |_subnode3 node3    |_subnode1 +node4 +node5 :-D :laugh: ;p :^) :sigh:

      L Offline
      L Offline
      LighthouseJ
      wrote on last edited by
      #2

      How are you building the list? I think it would be easier to sort the list out as you find data rather than sorting it later. I'm working on a similar problem myself at the moment, I'll let you know what I come up with when I solve it.

      1 Reply Last reply
      0
      • J JstDaNuGuy

        how can i sort treenodes in my treeView by similar text? NOT tView.Sorted = true, but by actually removing the duplicate nodes and adding their children to the 'new' parent node. Current: +node1 +node2 +node2 +node2 +node2 +node3 +node3 +node4 +node4 +node5 Desired: +node1 node2    |_subnode1    |_subnode2    |_subnode3 node3    |_subnode1 +node4 +node5 :-D :laugh: ;p :^) :sigh:

        I Offline
        I Offline
        Ingo
        wrote on last edited by
        #3

        It's simple. When you build your tree you should remember the last rootnode (R) added. If the text of the new node (N) is like the text of R then you have to add N to R instead of adding it to the tree. If the text isn't the same then you have to add N to the tree and remember it as R. Greetings, Ingo ------------------------------ A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!

        J 1 Reply Last reply
        0
        • I Ingo

          It's simple. When you build your tree you should remember the last rootnode (R) added. If the text of the new node (N) is like the text of R then you have to add N to R instead of adding it to the tree. If the text isn't the same then you have to add N to the tree and remember it as R. Greetings, Ingo ------------------------------ A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!

          J Offline
          J Offline
          JstDaNuGuy
          wrote on last edited by
          #4

          Well, thanks for the effort, but it doesn't work. and the reason is due to the a problem i think related to when or how i am calling my 'new TreeNode', as i am only replacing the text of the previous node with the 'next' nodes text. so in other words when i get to the point of adding new subnodes i only end up with one node. if you care to see my original code look here:[^] This is how i modified my orginal code to receive these results:

          //if (ParentNode.Nodes.Contains(DeptNode))
          if (rootNode == DeptNode.Text)
          {
          //if (ModNode.Tag == DeptNode.Tag)
          if (modelTag == rootTag)
          {
          //if (DeptNode.Nodes.Contains(ModNode))
          if (modelNode == ModNode.Text)
          {
          if (ModNode.Nodes.Contains(TelNode))
          //if (telNodex == TelNode.Text)

          :-D :laugh: ;p :^) :sigh:

          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