G
Guest
I am "learning" C# and have run into a problem that, though I can work around
it, I would like to know what the *right* way to handle the issue is.
I have created an "Info" struct and assigned certain default values to it.
I have assigned this struct to a TreeView node via the Tag field. In my
"AfterSelect" processing call, I am casting the node tag value to my "Info"
struct. When I look at the fields they are set to the default values that I
set earlier at instantiation time.
If I change the values in the "Info" struct, though, when the "AfterSelect"
callout is returned from and called again, the values are reset back to the
previous default values.
It looks to me that a new object is being created somewhere along the line,
such that in my "AfterSelect" routine I am changing the values of a "new"
object, and no the one initially set as the Tag value of the TreeView node.
My question is, how can I set the Tag of the TreeView control (or any other
control) to "point" to the struct I created at instantiation time? I only
want one copy floating around, and want changes to the object to persist
across each callout.
The answer is probably very simple (and the question itself gives my
newbieness away<g>).
Any help would be appreciated.
Thanks in advance,
-Brian
it, I would like to know what the *right* way to handle the issue is.
I have created an "Info" struct and assigned certain default values to it.
I have assigned this struct to a TreeView node via the Tag field. In my
"AfterSelect" processing call, I am casting the node tag value to my "Info"
struct. When I look at the fields they are set to the default values that I
set earlier at instantiation time.
If I change the values in the "Info" struct, though, when the "AfterSelect"
callout is returned from and called again, the values are reset back to the
previous default values.
It looks to me that a new object is being created somewhere along the line,
such that in my "AfterSelect" routine I am changing the values of a "new"
object, and no the one initially set as the Tag value of the TreeView node.
My question is, how can I set the Tag of the TreeView control (or any other
control) to "point" to the struct I created at instantiation time? I only
want one copy floating around, and want changes to the object to persist
across each callout.
The answer is probably very simple (and the question itself gives my
newbieness away<g>).
Any help would be appreciated.
Thanks in advance,
-Brian