How to assign object to tree node ?

  • Thread starter Thread starter RickDee
  • Start date Start date
R

RickDee

Let me explain what I would like to do.

I have created my own object which is able to execute or do something. Now I
created a few instances of that object and put them in the tree view. There
is no problem for me to display them in the tree view, but as far as I know
it only capture them as string. What I wanted to do is when I add a node in
the tree, I wanted to add that instance of that object itself. This is so
that later I can go through the tree and for those nodes with checked box
been set to true, I will execute that particular instance of object.

Have been trying very hard to find in the internet, but can't find anything
close enough.

If there is any example that anyone of you can provide, C# code is
preferred.

Thanks
Regards
 
RickDee said:
Let me explain what I would like to do.

I have created my own object which is able to execute or do something. Now I
created a few instances of that object and put them in the tree view. There
is no problem for me to display them in the tree view, but as far as I know
it only capture them as string. What I wanted to do is when I add a node in
the tree, I wanted to add that instance of that object itself. This is so
that later I can go through the tree and for those nodes with checked box
been set to true, I will execute that particular instance of object.

Have been trying very hard to find in the internet, but can't find anything
close enough.

If there is any example that anyone of you can provide, C# code is
preferred.

Node.Tag

Just cram each object into the Tag of the node that displays it.
Whenever you need it back just downcast it out of the Tag.

David
 
Back
Top