473,770 Members | 5,842 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Treeview (Basic question)

hello all,
New programmer to the .net world.

I am working with VS.net 2005 using VB.

So here goes.
I am trying to figure out how the treeview control works from a programming
perspective. I know how to populate it manually with the control properties.
my question revolves around the use of the Node method creating Root-parent
and the children of the parent.
for example
Country (Root)
US (parent)
States (Child)
Ohio (Sub child)
cities
Akron
cleveland
NY
Cities
Hamburg

in sudo code.
Sub
Create the tree object.
go to the root node and populate it.
if root is expanded create the parents
if a parent is expanded create the appropriate children
Endsub

Most of my questions revolve around understanding how to traverse the nodes.

thanks for anyones or everyones help
JayC
New to the .net world.

Sep 14 '06 #1
2 1386
Hi Jay,

It's real straight-forward; each TreeNode object has a Nodes collection
class member (of type TreeNodeCollect ion) that contains the TreeNode objects
that represent its children. That is, there is no single collection of all
the nodes in the tree; each node is essentially a container for its
children.

The Tree itself has a Nodes member that is a collection of all the top level
nodes; each of these has its children, etc.

If you want a single root node in the tree, then just add 1 TreeNode to the
Tree.Nodes collection, and then add children to that single root node.

HTH ...

"JayC" <Ja**@discussio ns.microsoft.co mwrote in message
news:41******** *************** ***********@mic rosoft.com...
hello all,
New programmer to the .net world.

I am working with VS.net 2005 using VB.

So here goes.
I am trying to figure out how the treeview control works from a
programming
perspective. I know how to populate it manually with the control
properties.
my question revolves around the use of the Node method creating
Root-parent
and the children of the parent.
for example
Country (Root)
US (parent)
States (Child)
Ohio (Sub child)
cities
Akron
cleveland
NY
Cities
Hamburg

in sudo code.
Sub
Create the tree object.
go to the root node and populate it.
if root is expanded create the parents
if a parent is expanded create the appropriate children
Endsub

Most of my questions revolve around understanding how to traverse the
nodes.

thanks for anyones or everyones help
JayC
New to the .net world.

Sep 15 '06 #2
that is what the document says. how about a simple example of doing a root
node, a child node and then a child of a child.

I am dense.

"Emby" wrote:
Hi Jay,

It's real straight-forward; each TreeNode object has a Nodes collection
class member (of type TreeNodeCollect ion) that contains the TreeNode objects
that represent its children. That is, there is no single collection of all
the nodes in the tree; each node is essentially a container for its
children.

The Tree itself has a Nodes member that is a collection of all the top level
nodes; each of these has its children, etc.

If you want a single root node in the tree, then just add 1 TreeNode to the
Tree.Nodes collection, and then add children to that single root node.

HTH ...

"JayC" <Ja**@discussio ns.microsoft.co mwrote in message
news:41******** *************** ***********@mic rosoft.com...
hello all,
New programmer to the .net world.

I am working with VS.net 2005 using VB.

So here goes.
I am trying to figure out how the treeview control works from a
programming
perspective. I know how to populate it manually with the control
properties.
my question revolves around the use of the Node method creating
Root-parent
and the children of the parent.
for example
Country (Root)
US (parent)
States (Child)
Ohio (Sub child)
cities
Akron
cleveland
NY
Cities
Hamburg

in sudo code.
Sub
Create the tree object.
go to the root node and populate it.
if root is expanded create the parents
if a parent is expanded create the appropriate children
Endsub

Most of my questions revolve around understanding how to traverse the
nodes.

thanks for anyones or everyones help
JayC
New to the .net world.


Oct 4 '06 #3

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

Similar topics

1
9655
by: Access User | last post by:
I'm looking for complete documentation for the activex component "TreeView" in Access. I need a complete list of methods and properties, if such a thing exists. Paul
3
2900
by: sho_nuff | last post by:
Question here: I have been trying to find a way to add existing nested nodes to a tree that already has nodes in it: So, my tree looks like this: -com -foo -goo
4
7599
by: Ian Powell | last post by:
Hi I've got objects in an sorted ArrayList like: P:\ P:\\DOCS P:\\i386 P:\\i386\ASMS P:\\i386\ASMS\1000 P:\\i386\ASMS\1000\MSFT
1
5888
by: http://www.visual-basic-data-mining.net/forum | last post by:
Hello, I am working on Treeview control. I want that, user create tree according to his requirement, can add topic under any node. Then just click update and that treeview data to be stored in MSAccess database. I already created how can he build tree but now unable to store tree data into dataset. So can somebody tell me how to store treeview data into dataset. Thank You in Advance.
0
1442
by: Teemu | last post by:
Hello. Please bear with me if this seems like a basic question (I'm just getting started with all this ASP.NET and WebControls stuff). Anyway, I'm trying to programmatically build a treeview based off a dataset that I've queried from our database. First, I'm manually creating and adding the "root" node to the treeview control. Then, I'm trying to iterate through my dataset and build all the folders and files under the root node.
3
11227
by: Gerhard | last post by:
I have the following code in an .net 2.0 project: <asp:Panel Runat="server" id="pnlNavigation" CssClass="pnlNavigation" Width="165px"> <asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" CssClass="nav" BorderStyle="None" CollapseImageToolTip="" ExpandImageToolTip="" ShowExpandCollapse="False"> <LevelStyles> <asp:TreeNodeStyle CssClass="homenav" Font-Underline="False" />
6
9974
by: Beginner | last post by:
Hi, I'm trying to populate a TreeView from an existing and filled in ListView (lvwBuild). lvwBuild is a basic two column listview which can have any number of rows. I would like the first column of lvwBuild to be a node and the second column to be a branch on the TreeView (hopefully I have the syntax correct). I've been researching how to do this but have come up empty. I'm guessing that you would fill an array from lvwBuild and...
8
12776
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the form. I only want to allow single selection, so using checkboxes is out of the question. It works as is, but it makes the form very cumbersome if every time that a user selects a node, the whole page has to reload. Is there a way to have a node...
0
829
by: Ahmed Yasser Dev | last post by:
Hi all, i am new to web development. My question is, is there is a TreeView control in the web applications ( Visual basic.net 2003). If not, what to do to build up a treeview component like the one in the windows forms? Thanks in advance.
2
1529
by: crystalelle | last post by:
Hi, I am in desperate of help. I am working with visual basic .net 2005. My interface is made from treeview control and tab control. The big question here is how do I load the tab control using the treeview control child node. Thanks
0
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10225
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10001
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7415
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.