如何在树视图中获取所选(单击)节点并将其作为字符串返回?
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
string selectedNodeText = e.Node.Text;
}
From the docs:
http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode.aspx
Maybe:
MessageBox.Show(((TreeView)sender).SelectedNode.Text)
Or
MessageBox.Show(((TreeView)sender).SelectedNode.Name)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.