PC Review


Reply
Thread Tools Rate Thread

Adding property's ?

 
 
Guest
Posts: n/a
 
      3rd Aug 2005
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


 
Reply With Quote
 
 
 
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      3rd Aug 2005
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 news:(E-Mail Removed)...
|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
|
|


 
Reply With Quote
 
Guest
Posts: n/a
 
      3rd Aug 2005
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




 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      3rd Aug 2005
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:(E-Mail Removed)...
| 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
|
|
|


 
Reply With Quote
 
Guest
Posts: n/a
 
      3rd Aug 2005
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


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




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a Property to a query John Spencer Microsoft Access VBA Modules 6 29th Jan 2008 06:49 PM
Adding code property to control property window NuBBeR Microsoft C# .NET 1 7th Oct 2004 05:15 PM
Adding a usercontrol's property in the property window Zyrthofar Blackcloak Microsoft VB .NET 2 29th Aug 2004 03:46 AM
Adding an About Property in UserControl =?Utf-8?B?Q2hyaXN0b3NY?= Microsoft Dot NET Framework 4 28th Mar 2004 04:40 AM
Adding to the Property Box Scott Meddows Microsoft VB .NET 0 17th Feb 2004 08:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:13 AM.