Hello all,
I thought this would be simple but it has turned out to be some what troublesome.
I have a treeview like so.
I want to delete child1 from the treeview then change the text of the parent to what the deleted childs text was essentially making the child the new parent so it would look like this.
I tried the following but it always seems to delete the entire treeview.
I would have thought that the first part would have made the child the selected node but I think it is just changing the name of the parent node then deleting it thus deleting all the node.
Thanks for your help.
Ty
I thought this would be simple but it has turned out to be some what troublesome.
I have a treeview like so.
VB.NET:
Hi im parent
Im child1
Im child2
I want to delete child1 from the treeview then change the text of the parent to what the deleted childs text was essentially making the child the new parent so it would look like this.
VB.NET:
Im child1
Im child2
VB.NET:
'Remove the child from the treeview as we are making it the parent now.
TreeView1.SelectedNode.Text = "Im child1"
TreeView1.Nodes.Remove(TreeView1.SelectedNode)
'Make the child the parent node.
TreeView1.SelectedNode.Text = "Im child1"
I would have thought that the first part would have made the child the selected node but I think it is just changing the name of the parent node then deleting it thus deleting all the node.
Thanks for your help.
Ty