Node TreeNode = TreeView.Nodes[0];
object Foo = new object();
Foo = TreeNode;
Treenode = Foo as TreeNode;
If the object Foo was pointing to was of type TreeNode (Which in the above
sample it is) this will work.
If not then in the above sample TreeNode will equal null.
You cannot set TreeNode to a generic object. (Dont know why you would want
to).
so you cannot do
TreeNode = new object() as TreeNode;
(You can but TreeNode will equal null)
HTH
JB
If you explain what you are trying to accomplish maybe we can help you
better.
"Matthew Sajdera" <MS******@Cox.net> wrote in message
news:ec**************@TK2MSFTNGP11.phx.gbl...
All -
I want to be able to set one generic variable to the instance of
another...
So lets say I have an object named objFoo that is initialized as a generic
object of type Object. Now I get returned to me a TreeView Node object
called objNode. How do I set my generic objFoo to objNode? objFoo =
objNode; doesn't seem to work.
Thanks in advance.
- Matt