473,320 Members | 1,744 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,320 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 3649
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. ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.