views:

1206

answers:

1

Can i tie a user object to a TreeNode in C#?

+2  A: 

Yes. You can use the Tag property to store any user object for a particular tree node.

http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode.tag.aspx

TreeNode node = CreateATreeNode();
node.Tag = myStateObject;
JaredPar
Perfect answer. I'd like to add that on a _AfterSelect event use ((TreeView)sender).SelectedNode.Tag;
acidzombie24