Adding property's ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Guest's Avatar

    #1

    Adding property's ?

    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 TreeNodeCollect ion?

    thanks


  • Jay B. Harlow [MVP - Outlook]

    #2
    Re: Adding property's ?

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

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

    Hope this helps
    Jay

    <Renee> wrote in message news:uZPsDtEmFH A.2628@tk2msftn gp13.phx.gbl...
    |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 TreeNodeCollect ion?
    |
    | thanks
    |
    |


    Comment

    • Guest's Avatar

      #3
      Re: Adding property's ?

      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?
      [color=blue]
      > Renee,
      > I commonly inherit from TreeNode to add custom properties, inherited
      > TreeNodes are still TreeNodes and will work with TreeNodeCollect ion.
      >
      > The "caveat" is that you need to cast your specific TreeNode to the[/color]
      specific[color=blue]
      > type when you access it from TreeNodeCollect ion.
      >
      > Hope this helps
      > Jay[/color]



      Comment

      • Jay B. Harlow [MVP - Outlook]

        #4
        Re: Adding property's ?

        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 news:OPojKkGmFH A.3816@tk2msftn gp13.phx.gbl...
        | 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 TreeNodeCollect ion.
        | >
        | > The "caveat" is that you need to cast your specific TreeNode to the
        | specific
        | > type when you access it from TreeNodeCollect ion.
        | >
        | > Hope this helps
        | > Jay
        |
        |
        |


        Comment

        • Guest's Avatar

          #5
          Re: Adding property's ?

          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

          [color=blue]
          > 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?
          >[/color]



          Comment

          Working...