Is it possible to add values to tree nodes?

c#, treeview, winforms

Solution

You may to use Tag property for storing values:

TreeNode node = new Node();
node.Tag = "value";

Advantage is that you can assign to Tag any object you want not just integer or string value.

Then you can use Tag as follow:

var value = node.Tag as YourObjectType; 

Problem

Is it possible to add text, and a value, to a tree node? For example, a node may have the text `Desktop`, but the value is `C:\Documents and Settings\All Users\Desktop`.

Original source