473,396 Members | 1,945 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.

Add method in the treeview control

Does anyone have any real world experience using the .Net version of the
treeview control? If so, Can you recommend any good documentation sources
for learning more about it. i.e. Methods, etc.

I have a few different samples projects and am looking for many more to help
me understand everything I can about it.

One of my current issues is in trying to add a node. I use the ADD method
but under the .net version, you MUST add the node under the parent which
assumes you have a reference to the node collection:
(i.e tvParentNode.Add ("New child Node description")

If I don't have reference to the parent node, how do i get it?
tvOntheForm.Nodes() requires an integer. I know the value I put in the
description, but the index can change ?
Nov 20 '05 #1
2 1296
Hi Ernest,

I have been using the WinForms TreeView in several real-world projects (see
the one in my signature, for example) and it works fine. I actually haven't
used anything except the MSDN library as the documentation.
One of my current issues is in trying to add a node. I use the ADD method
but under the .net version, you MUST add the node under the parent which
assumes you have a reference to the node collection:
(i.e tvParentNode.Add ("New child Node description")
This is simple. You first instantiate the parent (that is, root node):

Dim rootNode As TreeNode = New TreeNode(...) ' Specify node text etc. in the
arguments

Then, you add childs to that parent - you already know how this is done.

And finally, you attach the root to the tree itself:

treeView.Nodes.Add(rootNode)

P.S. The biggest difference between the .NET TreeView and the VB6 one is
probably that you are not stuck to the Add method to create new nodes - you
just can instantiate them directly.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ernest Cook" <er*********@hotmail.com> wrote in message
news:ed**************@TK2MSFTNGP11.phx.gbl... Does anyone have any real world experience using the .Net version of the
treeview control? If so, Can you recommend any good documentation sources
for learning more about it. i.e. Methods, etc.

I have a few different samples projects and am looking for many more to help me understand everything I can about it.

One of my current issues is in trying to add a node. I use the ADD method
but under the .net version, you MUST add the node under the parent which
assumes you have a reference to the node collection:
(i.e tvParentNode.Add ("New child Node description")

If I don't have reference to the parent node, how do i get it?
tvOntheForm.Nodes() requires an integer. I know the value I put in the
description, but the index can change ?


Nov 20 '05 #2
Cor
Hi Ernst,

The treeview is a nice thing to use.

What you have to remember is that it is not anymore a one part control, but
that there are two parts, the root and the node. (Treeview and treenodes)

What you are doing all the time is hanging (adding) nodes in a node and
those nodes again in the tree.

When you are used to, it is quiet easy. There is a lot of documentation
about it on MSDN.

The listview works in the same way; you can build your own explorer in no
time with those two. I hope this gives you some understanding about the
treeview.

I hope this helps a little bit
Cor
Nov 20 '05 #3

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

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...
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...
1
by: Victor Rodriguez | last post by:
Is there a way that I can have a client side event like oncontextmenu="showfunction();" on each node? thanks, Victor
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
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: 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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.