Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check whether treeview root node has child nodes exists or not

I have a treeview with a root node initially as Root. If i right click on Root node i will have a context menu displayed with some options as New and other if i select New i will add a child node to the Root node. If i again Right click on the Root node and if the Root has child nodes i would like to clear all child nodes and add a new child node how can i do this

like image 778
Developer Avatar asked Sep 23 '10 11:09

Developer


1 Answers

TreeNode.Nodes gives you a list of all child nodes to the node you're looking at.

You can then call Clear on that collection to delete all childnodes.

like image 143
Hans Olsson Avatar answered Sep 30 '22 12:09

Hans Olsson