Nalin Kumar Balaji Shanmugam
asked on
Removing the First Inserted TreeNode in the Tree Without removing the Child
In the Below For loop i am Inserting a Treenode First ( at the Time of adding Node "TreeviewParent.Nodes.Add( Node)" the value of Node.Nodes.Count=0. After that when i insert a childnode below the Treenode I defined. Then i want to remove the Node. How can i remove the Parent
For Each dr In drs
Node = New TreeNode
Node.Text = dr(FieldName)
TreeviewParent.Nodes.Add(N ode)
cnode = New TreeNode
cnode.Text = dr(FieldName)
Node.Nodes.Add(cnode)
cnode.Parent.Remove()
Next
For Each dr In drs
Node = New TreeNode
Node.Text = dr(FieldName)
TreeviewParent.Nodes.Add(N
cnode = New TreeNode
cnode.Text = dr(FieldName)
Node.Nodes.Add(cnode)
cnode.Parent.Remove()
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you want to remove the parent node and take the orphaned child node and move it up one level?
If this is the case, what should happen to all the siblings of the node being moved up the tree hierarchy?
Do they get moved up as well or do they get deleted?
a
b1
c1
c2
c3
b2
d1
d2
d3
In the above tree, if we remove the parent of b1, should we end up with this:
b1
c1
c2
c3
Or this:
b1
c1
c2
c3
b2
d1
d2
d3
If this is the case, what should happen to all the siblings of the node being moved up the tree hierarchy?
Do they get moved up as well or do they get deleted?
a
b1
c1
c2
c3
b2
d1
d2
d3
In the above tree, if we remove the parent of b1, should we end up with this:
b1
c1
c2
c3
Or this:
b1
c1
c2
c3
b2
d1
d2
d3
ASKER
Regards
Baaji