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