Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Mon, 30 Jun 2008 16:38:23 -0700,    group: microsoft.public.dotnet.framework.windowsforms.controls        back       


TreeView - Finding Nodes   
I am struggling to find an easy way of identifying a TreeNode from its 
FullPath or Key/Name. I found a MSFT VB example and after carefully 
converting it to C# discovered that it only identifies a node after I've 
clicked on it, I could probably do that on my own!

The Key/Name property doesn't seem to help, i.e. I still can't find a node 
like this:

TreeNode tnRequired = myTreeView.Nodes["name"];

although the help implies this should work.

It is not possible to base a class on TreeNodeCollection and using 
CollectionBase means pretty well re-inventing the wheel.

I have something crude working using a HashTable but I have to use my own 
'AddNode' function since I can't trap the Nodes.Add event.

Has this been cracked by anybody or am I wasting my time looking?

Many thanks :-)

-- 
Jeff Gaines Damerham Hampshire UK
It may be that your sole purpose in life is to serve as a warning to others.
date: Mon, 30 Jun 2008 16:38:23 -0700   author:   Jeff Gaines am

Re: TreeView - Finding Nodes   
Hi,

You can use TreeView.Nodes.Find to find a node by its key....  What you 
tried doesn't work perhaps because this node is note at this level but 
beneath (Find allows to search iehter the current collection or to search 
also in child collections).

--
Patrice

"Jeff Gaines" <whitedragon@newsgroups.nospam> a écrit dans le message de 
groupe de discussion : xn0fs5c5rufasvt000@msnews.microsoft.com...
>
> I am struggling to find an easy way of identifying a TreeNode from its 
> FullPath or Key/Name. I found a MSFT VB example and after carefully 
> converting it to C# discovered that it only identifies a node after I've 
> clicked on it, I could probably do that on my own!
>
> The Key/Name property doesn't seem to help, i.e. I still can't find a node 
> like this:
>
> TreeNode tnRequired = myTreeView.Nodes["name"];
>
> although the help implies this should work.
>
> It is not possible to base a class on TreeNodeCollection and using 
> CollectionBase means pretty well re-inventing the wheel.
>
> I have something crude working using a HashTable but I have to use my own 
> 'AddNode' function since I can't trap the Nodes.Add event.
>
> Has this been cracked by anybody or am I wasting my time looking?
>
> Many thanks :-)
>
> -- 
> Jeff Gaines Damerham Hampshire UK
> It may be that your sole purpose in life is to serve as a warning to 
> others.
date: Tue, 1 Jul 2008 15:53:49 +0200   author:   Patrice http://www.chez.com/scribe/

Re: TreeView - Finding Nodes   
On 01/07/2008 in message 
 Patrice wrote:

>You can use TreeView.Nodes.Find to find a node by its key....  What you 
>tried doesn't work perhaps because this node is note at this level but 
>beneath (Find allows to search iehter the current collection or to search 
>also in child collections).

Thank you Patrice, that is new to me, I'll give it a try :-)

-- 
Jeff Gaines Damerham Hampshire UK
There is no reason anyone would want a computer in their home.
(Ken Olson, president Digital Equipment, 1977)
date: Tue, 01 Jul 2008 08:15:35 -0700   author:   Jeff Gaines am

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us