我想问你如何仅从C#中的树视图控件中删除节点

问题描述:

我想问你如何仅在C#中从树视图控件中删除节点

I want to ask you How to Delete nodes from Tree view Control in C# only

假设要使用System.Windows.Forms.TreeView,请使用System.Windows.Forms.TreeView.Nodes财产;它具有您需要的方法.

—SA
Assuming you want to work with System.Windows.Forms.TreeView, use System.Windows.Forms.TreeView.Nodes property; it has the methods you need.

—SA


Google是您的朋友:很好,经常拜访他.与在这里发布问题相比,他可以更快地回答问题.

如果您使用主题进行搜索,则可以在 MSDN [ ^ ]
Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...

If you had searched using your subject, you would have found the answer on MSDN[^]


删除选定的节点
Delete selected node
treeView1.SelectedNode.Remove();



通过索引



via index

treeView1.Nodes[0].Remove();