如何检查TreeView根节点是否存在子节点 [英] How to check whether treeview root node has child nodes exists or nor

查看:397
本文介绍了如何检查TreeView根节点是否存在子节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个树形视图,其根节点最初是Root.如果我右键单击根节点",则将显示一个上下文菜单,其中包含一些选项,如新建",如果选择新建",则其他选项将向根"节点添加子节点.如果我再次右键单击根"节点,并且根"具有子节点,我想清除所有子节点并添加新的子节点,我该怎么做

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

推荐答案

查看:
TreeNode.Nodes.Add(childNode)
TreeNode.Nodes.Clear()
TreeNode.Nodes.Count


所有这些都可以通过Google在MSDN上获得.


All available on MSDN via Google.


这篇关于如何检查TreeView根节点是否存在子节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆