Adding property's ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to add a string property to a TreeNode object. One way
I can do this is to use the tag property. Here is my question,
can I do it this way, create a new class e.g. MyTreeNode which
inherits from TreeNode and adds what I need. Will such
an object be compatible with TreeView and TreeNodeCollection?

thanks
 
Renee,
I commonly inherit from TreeNode to add custom properties, inherited
TreeNodes are still TreeNodes and will work with TreeNodeCollection.

The "caveat" is that you need to cast your specific TreeNode to the specific
type when you access it from TreeNodeCollection.

Hope this helps
Jay

<Renee> wrote in message |I need to add a string property to a TreeNode object. One way
| I can do this is to use the tag property. Here is my question,
| can I do it this way, create a new class e.g. MyTreeNode which
| inherits from TreeNode and adds what I need. Will such
| an object be compatible with TreeView and TreeNodeCollection?
|
| thanks
|
|
 
Jay, I have done this, added a property to MyTreeNode, and then globaly
searched and replaced all the TreeNodes to MyTreeNodes, and now the
program doesn't work any more, any ideas?
 
Renee,
| and now the
| program doesn't work any more, any ideas?
What specifically do you mean "doesn't work any more".

Is there a specific Exception you are getting?

A specific compile error you are getting?

Can you show 10 to 15 lines of code that identifies the problem you are
having?

Hope this helps
Jay



<Renee> wrote in message | Jay, I have done this, added a property to MyTreeNode, and then globaly
| searched and replaced all the TreeNodes to MyTreeNodes, and now the
| program doesn't work any more, any ideas?
|
| > Renee,
| > I commonly inherit from TreeNode to add custom properties, inherited
| > TreeNodes are still TreeNodes and will work with TreeNodeCollection.
| >
| > The "caveat" is that you need to cast your specific TreeNode to the
| specific
| > type when you access it from TreeNodeCollection.
| >
| > Hope this helps
| > Jay
|
|
|
 
No there is no exception, the program compiles and run fine, but my
treeview is not being filled with the nodes, i.e. the program is
running, but not doing what it is supposed to. I shall have to do
debugging, I'll let you know what it was when I find the problem.

tnx
 
Back
Top