bornagaindeveloper
bornagaindeveloper

Reputation: 59

Saving object in tag of treeview node

Is it possible to save two objects in the tag property of a treeview node?

If so, how can I do so

Thanks bornagaindeveloper

Upvotes: 0

Views: 1347

Answers (2)

olegz
olegz

Reputation: 1222

You could store the values to array and store array in Tag.

node.Tag = new object[] {value1, value2};
value1_ = ((object[])node.Tag)[0];
...

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038730

No, but it is possible to write a third class which has two properties pointing to your classes and save this third object to the treenode tag. You could also use the Tuple class that has been introduced in .NET 4.0 if you don't want to write a third class yourself but I must admit that it could make your code more readable if you did.

Upvotes: 2

Related Questions