Question : how to set integer in treenode tag

hi
I need to save a counter for each tree node and I think the best place to store is in the node.tag
my question is how could I make the tag store integer number so i can increment it each time

p.s i am using tree view in c#

thanks in  advance for your help

suzan

Answer : how to set integer in treenode tag

TreeNode.Tag actually accepts object data type, which means you can assign anything, including integer. The only thing to remember is that, don't assign it through the visual studio designer, because it will treat data as string.

To assign:
node.Tag = 1;

To read data:
int tagValue = (int) node.Tag;
Random Solutions  
 
programming4us programming4us