473,394 Members | 1,781 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,394 software developers and data experts.

Setting Treeview Index

I have tried the following code to set the index for a
node. It seems to work when I use the root node index of
0. When I try a number greater than 0 I get an out of
range error. I made sure that the tree was expanded, as
well.

treeView1.Focus();
treeView1.SelectedNode = treeView1.Nodes[1];

Nov 15 '05 #1
3 7320
Kelvin,

How many nodes are there under the root? I think that the Nodes that
are being exposed is the top level of nodes, and not all of the nodes in the
tree. If you have only one node at the root, then this would definitely
fail.

Hope this helps.
"Kelvin Bryant" <ke***********@hotmail.com> wrote in message
news:0b****************************@phx.gbl...
I have tried the following code to set the index for a
node. It seems to work when I use the root node index of
0. When I try a number greater than 0 I get an out of
range error. I made sure that the tree was expanded, as
well.

treeView1.Focus();
treeView1.SelectedNode = treeView1.Nodes[1];

Nov 15 '05 #2

"Kelvin Bryant" <ke***********@hotmail.com> wrote in message
news:0b****************************@phx.gbl...
I have tried the following code to set the index for a
node. It seems to work when I use the root node index of
0. When I try a number greater than 0 I get an out of
range error. I made sure that the tree was expanded, as
well.

treeView1.Focus();
treeView1.SelectedNode = treeView1.Nodes[1];


Note that treeView1.Nodes is only the list of nodes branching off the root;
not all the nodes in the entire tree.

treeView1.Nodes[1].Nodes is the list of nodes that branch off node 1, and so
forth. It's a recursive data structure.
Nov 15 '05 #3
Yes, you are on to something! My structure is as such:
Root Node
Parent Node 1
Child Node 1
Child Node 2
Child Node 3
Parent Node 2
Child Node 1
Child Node 2
Blah Blah Blah
-----Original Message-----
Kelvin,

How many nodes are there under the root? I think that the Nodes thatare being exposed is the top level of nodes, and not all of the nodes in thetree. If you have only one node at the root, then this would definitelyfail.

Hope this helps.
"Kelvin Bryant" <ke***********@hotmail.com> wrote in messagenews:0b****************************@phx.gbl...
I have tried the following code to set the index for a
node. It seems to work when I use the root node index of
0. When I try a number greater than 0 I get an out of
range error. I made sure that the tree was expanded, as
well.

treeView1.Focus();
treeView1.SelectedNode = treeView1.Nodes[1];

.

Nov 15 '05 #4

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

Similar topics

4
by: JoKur | last post by:
I'm currently using a context menu to allow the user to add, rename and delete nodes in a treeview control. When a node is added we give it a bogus name ("NewNode") and invoke the add method. We...
6
by: meh | last post by:
I can figure out the total number of nodes in a given tree but what I'd like to know is what is the Selected Nodes relationship to the entire tree i.e This is node n out of nnn nodes. In most of...
8
by: Don Wash | last post by:
Hi There! I'm using VB.NET to create a TreeView application and unfortunately I could not find "Key" property in Node items of the TreeView. We used to have "Key" property in TreeView node...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
0
by: Sarika | last post by:
Hi, I am a little confused about associating an image w/ the VB.NET TreeView Control. My specific requirement is that I want to associate an image w/ some specific nodes in the TreeView only. ...
10
by: p3t3r | last post by:
I have a treeview sourced from a SiteMap. I want to use 2 different CSS styles for the root level nodes. The topmost root node should not have a top border, all the other root nodes should have a...
3
by: musosdev | last post by:
Hi guys How do I get the new TreeView (asp2.0) to load something in an Iframe? I've setup a NaviagateUrl and set the Target property to the name of the Iframe, but it still tries to load a new...
0
by: uncensored | last post by:
Hi, Sort of new with the whole treeview control and I was wondering is there a way to build a treeview menu using my SQL data I pull from a database instead of having to hard code it into the...
1
by: doemon | last post by:
Hi, I'm working on a pagination control and I need to dynamically rerender a treeview to display the next set of nodes depending on which page we're on. For example, page 1 will dispaly only...
0
by: divya1949 | last post by:
Create a windows c# application which will Read a xml file and populate nodes in the treeview. 1 On selection of treenode display the child nodes of that node in listview control 2. ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.