在vb.net的树形视图中选择子节点时,如何获取父节点名称 [英] How do i get the parent node name when i select the child node in a tree view in vb.net
本文介绍了在vb.net的树形视图中选择子节点时,如何获取父节点名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在vb.net的树状视图中选择子节点时,如何获得父节点名称?我已经尝试了2天,但是如果有任何1个可以帮助我的解决方案,我将无法获得任何解决方案.... ...
How do i get the parent node name when i select the child node in a tree view in vb.net i have tried it for 2 days but i fail to get any solution if any 1 could help me plz.......
推荐答案
2天???好......
您正在处理NodeMouseClient或AfterSelect事件吗?两者都将为您提供被单击或选择的TreeNode.
您是否注意到每个TreeNode对象都有一个Parent
属性?它为您提供了父节点,然后您只需查看Parent
的Text
属性即可.
2 days?? OK....
Are you handling the NodeMouseClient or AfterSelect events? Both will give you the TreeNode that is clicked or selected.
Did you notice that every TreeNode object has aParent
property?? It gives you the parent node and from there, you just need to look at theText
property of theParent
.
Dim parentText As String = currentNode.Parent.Text
如果您阅读有关TreeNode类的文档,或者至少浏览了Intellisense中TreeNode类的成员,将会有所帮助.
It would help if you read the documentation on the TreeNode class or at least browsed through the members of the TreeNode class in Intellisense.
这篇关于在vb.net的树形视图中选择子节点时,如何获取父节点名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文