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

Hirerical Treeview control in VB.NET

How to create a hirerical treeview control in VB.NET 2005.Like I want in this way.

:: GrandParent is GD1
Parent is : P1
and Child is C1,C2,C3 and so on.
Thanks.
Jun 9 '08 #1
2 1603
shweta123
692 Expert 512MB
Hi,

You can do it this way :

Expand|Select|Wrap|Line Numbers
  1.     '''Variable declaration
  2.     Dim gd1 as new Treenode
  3.     Dim p1 as new Treenode
  4.     Dim c1 as new Treenode
  5.     Dim c2 as new Treenode
  6.     Dim c3 as new Treenode
  7.  
  8.  
  9.     '''Define node for grandParent
  10.     gd1.Text = "GrandParent"
  11.  
  12.    '''define node for parent
  13.     p1.Text = "Parent"
  14.  
  15.    '''define child nodes
  16.     c1.Text = "Child1"
  17.     c2.Text = "Child2"
  18.     c3.Text = "Child3"
  19.  
  20.    '''Add child nodes to parent node
  21.       p1.Nodes.Add(c1)
  22.       p1.Nodes.Add(c2)
  23.       p1.Nodes.Add(c3)
  24.  
  25.     ''Add parent node to grandparent node 
  26.     gd1.Nodes.Add(p1)
  27.  
  28.     ''Now, you can add grandparent node to treeview control  
  29.     Treeview1.Nodes.Add("gd1")
Jun 9 '08 #2
Plater
7,872 Expert 4TB
Isn't that what the TreeView object is for?
Jun 9 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: SoKool | last post by:
Can anyone point me to a site where I can get a free treeview control to use in ASP .NET or any tutorial that can help me build my own treeview control. I intend to use a treeview to generate a...
8
by: Hrvoje Voda | last post by:
What is wrong in this code? private void tree_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if (e.KeyCode == Keys.Enter ) {
3
by: Peter | last post by:
Hello, We are inserting a side menu to our application using a class that is writing HTML on all our pages. This is a part of the code as an example: writer.Write(" <table WIDTH=""100%""...
4
by: Ben Coats | last post by:
Hey, I'm trying to find code for an Explorer-style Directory ComboBox. (You know, it display "Desktop", "My Computer", all drives, etc., but it has a treeview control inside the combobox so that...
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...
1
by: musosdev | last post by:
Hi guys I was using the Microsoft.Web.UI.WebControls extra namespace in my application to provide me with a TreeView control. I was using specifically ..GetNodeFromIndex(), SelectedNodeIndex and...
5
by: david | last post by:
I do not know if there is a treeView control for web form in .NET 1.1. I know there is IE Webcontrol package which has the treeview control for ..net 1.0. I have tested it in .net 1.1 before. It...
0
by: noneya22 | last post by:
I want to use a TreeView control as a one-level, vertical navigation menu. I'm using this control currently with a SiteMapDataSource and .sitemap file. I've written code that associates an image...
0
by: jiing | last post by:
Hi all, I want to use sting(the same as Node.Text) to judge if a node exists in TreeView. I've tried several ways, but seems all failed. could anybody help me? Thanks in advance. //My...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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.