VB.NET: Tree Nodes Don't have Key property !!

When developing an application in VB.NET I was very disappointed to know that there is no Key property provided for the TreeNode objects. Well, at

ITPro Today

April 7, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today

When developing an application in VB.NET I was very disappointed to know that there is no Key property provided for the TreeNode objects.

Well, at least I can't work without Key property, as I always keep the IDs of my items in the Key property only.

So, finally i used the following custom Node class for my purpose.

To access the nodes, we just have to typecast the selected node of the tree to our custom class.

You can add any property you require in the same class for extensibility.

ndCurrentNode = CType(tvwStructure.SelectedNode, clsCustomTreeNode)

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like