The documentation says this:
"The
Name property corresponds to the key for a
TreeNode in the
TreeNodeCollection."
So if you are getting the name, you are already getting the key.
This is the code I tried:
Dim tv As New TreeView
tv.Nodes.Add("Key1", "Apple")
tv.Nodes.Add("Key2", "Banana")
Me.Controls.Add(tv)
For Each n As TreeNode In tv.Nodes
Debug.WriteLine(n.Name)
Next
Hope this helps.
www.insteptech.com ;
msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!