473,473 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

NextVisibleNode is not consistent

Hi,

I am using TreeNode.NextVisibleNode to loop though all nodes in a tree. I
think this is faster than using recursive algorithm.

But I found this method is not consistent. Sometime it returns right
treeNode, sometime it returns null.

What does "Visible" mean? It is not necessary shown on the form and visible
to our eyes, right?

And form my TreeView, there are multiple first lever nodes(multiple root),
is this a problem? But why it is not consistent?

And even TreeView has multiple root nodes, all those first level nodes are
belong to one parent TreeNode. I just don't want this real root TreeNode
shown on the treeview.

Thanks!
Ryan
Jun 2 '07 #1
2 1575
On Fri, 01 Jun 2007 19:15:07 -0700, Ryan Liu <Ry*******@gmail.comwrote:
I am using TreeNode.NextVisibleNode to loop though all nodes in a tree. I
think this is faster than using recursive algorithm.
I suppose that depends on what you are actually trying to do. But if you
are literally trying to visit each node in the tree, it's faster but only
because it doesn't produce the desired results.
But I found this method is not consistent. Sometime it returns right
treeNode, sometime it returns null.
If there is no visible node after the one you're looking at, it will
return null. Are you saying that it returns null when there *is* a
visible node after the one you're accessing the property from?
What does "Visible" mean? It is not necessary shown on the form and
visible
to our eyes, right?
"Visible" means that the node is displayed on the TreeView. It
corresponds to the TreeNode.IsVisible property, which is true as long as
the tree node is at least partially in view.
And form my TreeView, there are multiple first lever nodes(multiple
root),
is this a problem? But why it is not consistent?
There should be no trouble with multiple root-level nodes.
And even TreeView has multiple root nodes, all those first level nodes
are
belong to one parent TreeNode. I just don't want this real root TreeNode
shown on the treeview.
Then don't create it. The TreeView instance has a TreeNodeCollection that
contains all the root level nodes. If you want all of your root level
nodes to be at the actual root level, then don't make them children of
some single root level node. Just add them to the TreeView itself.

Pete
Jun 2 '07 #2
Peter,

Thanks a lot for your detailed reply!

I think I mis-understanding "Visible".

-Ryan

"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Fri, 01 Jun 2007 19:15:07 -0700, Ryan Liu <Ry*******@gmail.comwrote:
>I am using TreeNode.NextVisibleNode to loop though all nodes in a tree. I
think this is faster than using recursive algorithm.

I suppose that depends on what you are actually trying to do. But if you
are literally trying to visit each node in the tree, it's faster but only
because it doesn't produce the desired results.
>But I found this method is not consistent. Sometime it returns right
treeNode, sometime it returns null.

If there is no visible node after the one you're looking at, it will
return null. Are you saying that it returns null when there *is* a
visible node after the one you're accessing the property from?
>What does "Visible" mean? It is not necessary shown on the form and
visible
to our eyes, right?

"Visible" means that the node is displayed on the TreeView. It
corresponds to the TreeNode.IsVisible property, which is true as long as
the tree node is at least partially in view.
>And form my TreeView, there are multiple first lever nodes(multiple
root),
is this a problem? But why it is not consistent?

There should be no trouble with multiple root-level nodes.
>And even TreeView has multiple root nodes, all those first level nodes
are
belong to one parent TreeNode. I just don't want this real root TreeNode
shown on the treeview.

Then don't create it. The TreeView instance has a TreeNodeCollection that
contains all the root level nodes. If you want all of your root level
nodes to be at the actual root level, then don't make them children of
some single root level node. Just add them to the TreeView itself.

Pete

Jun 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robert Oschler | last post by:
Is there a Javascript function, or library, that will take a URL and make it uniform/consistent? Something that will resolve all relative pathing and the current domain and protocol and return a...
3
by: ssb | last post by:
Hello, I have multiple forms in my access application. I want all the forms to have consistent formatting for fields appearing on the forms (i.e. same background color, fonts, font color etc). ...
2
by: RBohannon | last post by:
I need to create a report in MS Word populated with data from A2K. I have been asked to create the report in Word so that parts of it can be edited as necessary later. The data in the report are...
1
by: Bret Pehrson | last post by:
I've converted a non-trivial C++ library to managed, and get the following unhelpful linker error: Assignment.obj : error LNK2022: metadata operation failed (80131195) : Custom attributes are...
1
by: Tamas Demjen | last post by:
I started to experiment with VC++ 2005 Beta1. So far everything went fine, and already have a working project, but soon I realized that the compiler was ancient (not supporting half of the C++/CLI...
1
by: lovecreatesbeauty | last post by:
There is a warning/(error? I remember it is an error for line 10 on some compilers before. At least on g++, it is an error.) for line 10. I first read a similar example from `Expert C Programming...
8
by: digitalorganics | last post by:
What are the reason one would get this error: TypeError: Cannot create a consistent method resolution order (MRO) for bases object ?? I can provide the code if needed....
8
by: jpullam | last post by:
It was suggested elsewhere by a moderator that it is a good practice to use "* {margin:0}" at the beginning of my style sheet to turn off the browser-dependent spacing. Presumably this is one step to...
0
by: TimeHorse | last post by:
Is there a consistent way to map a frame object to a function / method object? Methods usually hang off of parameter 1, and functions usually in the global or local scope. But lambda functions...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.