473,231 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

TreeNode.EnsureVisible question

HI NG!
I have a problem which is very confusing for me.
In my app it is possible that the tree view will be cleared and
created completely new.
To provide nice usability i would like to expand all nodes, which were
expanded before the new creation of the tree view.

So I save the first child node of all expanded nodes in a arraylist
and use a clone of this array list after the new creation of the tree
view.

Now my question:
1.) The EnsureVisible function works fine, if i call the EnsureVisible
function like this:

Nodes[0].Nodes[node.Parent.Index].Nodes[node.Index].EnsureVisible();

2.) but it does not work if I obtain my nodes from the arraylist and
call the function directly on this node. Like this:
node.EnsureVisible();

Why is it needed to call the function as described in point 1 ? I
recognized the same behavior with the Expand and ExpandAll functions.

Do you have an hint for a better solution of my problem?

Thanks and regards
Marcel
Apr 8 '08 #1
1 3639
On Tue, 08 Apr 2008 08:11:42 -0700, schaf <sc***@2wire.chwrote:
[...]
2.) but it does not work if I obtain my nodes from the arraylist and
call the function directly on this node. Like this:
node.EnsureVisible();

Why is it needed to call the function as described in point 1 ?
Without actual code, it's impossible to say for sure. But I didn't read
anything in your description that would suggest that your new TreeView
nodes are the same ones you had before. If your new TreeView doesn't
include the same actual TreeNode instances you stored in your ArrayList,
then of course calling EnsureVisible() on the nodes in the ArrayList isn't
going to have any effect (nor the expand methods).

Pete
Apr 8 '08 #2

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

Similar topics

2
by: Wes | last post by:
I have a treeview that I am continually added nodes to. Each time a new node is added I would like to select that node. Is this possible? I have looked at selectedNode, but I don't know how to...
3
by: Polo | last post by:
Hi, How can I set the SelectedNode (by code) visible in the tree (the first visible node in the control) ? thank's
8
by: | last post by:
I have the following class : Public Class MyTreeNode Inherits TreeNode Dim mystring As String End Class Now, when I try to do this : ''''''''''''nodes is a TreeNodeCollection, s is string
2
by: Ben H | last post by:
Hello all I'm using a listview in my app but I want to scroll the listview programatically as I hate the look of the standard scrollbar. So, the listview is scrolled programatically using...
1
by: Turban | last post by:
When I attempt to run the following code: protected void NavigationTreeView_TreeNodePopulate(object sender, TreeNodeEventArgs e) { TreeNode tn1 = new TreeNode("node1","node1"); TreeNode tn2 =...
4
by: Karl Rhodes | last post by:
Hi all... Perhaps I'm not going about this the right way, but I wondered if anyone can help? I have a treeview which populates from a datatable using a parent/ child relationship. It stores a...
4
by: Rob Stevens | last post by:
Is there some sort of unique identifier in every treenode that is consistent? I was looking at the handle of every treenode, but it appears that the handle changes everytime the tree is built. ...
1
by: jmDesktop | last post by:
I am trying to add nodes with keys to my treeview. I can add general nodes without problem with: //create new node TreeNode newNode = new TreeNode(myIdNumber); //create children TreeNode...
1
by: AAaron123 | last post by:
If you see this posted twice - sorry. My news reader showed my first post as "No Longer Available" I have the following in a .css file. The treeNodes behave as if they were "a" elements. ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.