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

C# .NET generating trees - child nodes?

Liz
C# .NET creating a tree programmatically

treeView1.BeginUpdate();
treeView1.Nodes.Clear();
treeView1.Nodes.Add(new TreeNode("Client Details"));
tvSelect.Nodes.Add(new TreeNode("Referrals"));
tvSelect.EndUpdate();

Can anyone tell me how I add child nodes to the above
tree?

Liz
Nov 15 '05 #1
5 9173
Liz,
Your
treeView1.Nodes.Add(new TreeNode("Client Details"));
will return a reference to a TreeNode class which you can then add more
subnodes to.

HTH
Kieran

"Liz" <ec******@cornwall.gov.uk> wrote in message
news:07****************************@phx.gbl...
C# .NET creating a tree programmatically

treeView1.BeginUpdate();
treeView1.Nodes.Clear();
treeView1.Nodes.Add(new TreeNode("Client Details"));
tvSelect.Nodes.Add(new TreeNode("Referrals"));
tvSelect.EndUpdate();

Can anyone tell me how I add child nodes to the above
tree?

Liz

Nov 15 '05 #2
Liz
Thanks for the pointer Kieran - Liz
-----Original Message-----
Liz,
Your
treeView1.Nodes.Add(new TreeNode("Client Details"));
will return a reference to a TreeNode class which you can then add moresubnodes to.

HTH
Kieran

"Liz" <ec******@cornwall.gov.uk> wrote in message
news:07****************************@phx.gbl...
C# .NET creating a tree programmatically

treeView1.BeginUpdate();
treeView1.Nodes.Clear();
treeView1.Nodes.Add(new TreeNode("Client Details"));
tvSelect.Nodes.Add(new TreeNode("Referrals"));
tvSelect.EndUpdate();

Can anyone tell me how I add child nodes to the above
tree?

Liz

.

Nov 15 '05 #3
Liz
Sorry to be so thick Kieran, but could you kindly show me
an example?? I seem to be going round in circles trying
to get this to work - Liz
-----Original Message-----
Liz,
Your
treeView1.Nodes.Add(new TreeNode("Client Details"));
will return a reference to a TreeNode class which you can then add moresubnodes to.

HTH
Kieran

"Liz" <ec******@cornwall.gov.uk> wrote in message
news:07****************************@phx.gbl...
C# .NET creating a tree programmatically

treeView1.BeginUpdate();
treeView1.Nodes.Clear();
treeView1.Nodes.Add(new TreeNode("Client Details"));
tvSelect.Nodes.Add(new TreeNode("Referrals"));
tvSelect.EndUpdate();

Can anyone tell me how I add child nodes to the above
tree?

Liz

.

Nov 15 '05 #4
Liz,

Sure thing.

treeView1.BeginUpdate();
treeView1.Nodes.Clear();
TreeNode node1 = new TreeNode("Client Details");
treeView1.Nodes.Add(node1);
node1.Nodes.Add(new TreeNode("Address1"));
treeView1.EndUpdate();

Sorry I actually probably confused you there slightly! My understanding that
Nodes.Add returned a TreeNode was incorrect!

HTH
Kieran
"Liz" <ec******@cornwall.gov.uk> wrote in message
news:08****************************@phx.gbl...
Sorry to be so thick Kieran, but could you kindly show me
an example?? I seem to be going round in circles trying
to get this to work - Liz
-----Original Message-----
Liz,
Your
treeView1.Nodes.Add(new TreeNode("Client Details"));
will return a reference to a TreeNode class which you

can then add more
subnodes to.

HTH
Kieran

"Liz" <ec******@cornwall.gov.uk> wrote in message
news:07****************************@phx.gbl...
C# .NET creating a tree programmatically

treeView1.BeginUpdate();
treeView1.Nodes.Clear();
treeView1.Nodes.Add(new TreeNode("Client Details"));
tvSelect.Nodes.Add(new TreeNode("Referrals"));
tvSelect.EndUpdate();

Can anyone tell me how I add child nodes to the above
tree?

Liz

.

Nov 15 '05 #5
Liz
Kieran,

Thanks. I was getting myself tied up in nesting. It's
really much the same as the VB version I had, once you
get tuned into the C# syntax. Thank you for your help.
Liz
-----Original Message-----
Liz,

Sure thing.

treeView1.BeginUpdate();
treeView1.Nodes.Clear();
TreeNode node1 = new TreeNode("Client Details");
treeView1.Nodes.Add(node1);
node1.Nodes.Add(new TreeNode("Address1"));
treeView1.EndUpdate();

Sorry I actually probably confused you there slightly! My understanding thatNodes.Add returned a TreeNode was incorrect!

HTH
Kieran
"Liz" <ec******@cornwall.gov.uk> wrote in message
news:08****************************@phx.gbl...
Sorry to be so thick Kieran, but could you kindly show me an example?? I seem to be going round in circles trying
to get this to work - Liz
>-----Original Message-----
>Liz,
>Your
>treeView1.Nodes.Add(new TreeNode("Client Details"));
>will return a reference to a TreeNode class which you

can then add more
>subnodes to.
>
>HTH
>Kieran
>
>"Liz" <ec******@cornwall.gov.uk> wrote in message
>news:07****************************@phx.gbl...
>> C# .NET creating a tree programmatically
>>
>> treeView1.BeginUpdate();
>> treeView1.Nodes.Clear();
>> treeView1.Nodes.Add(new TreeNode("Client Details"));
>> tvSelect.Nodes.Add(new TreeNode("Referrals"));
>> tvSelect.EndUpdate();
>>
>> Can anyone tell me how I add child nodes to the above >> tree?
>>
>> Liz
>
>
>.
>

.

Nov 15 '05 #6

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

Similar topics

6
by: Alex Le Dain | last post by:
Is there a generic "tree" module that can enable me to sort and use trees (and nodes). Basically having methods such as .AddNode(), ..GetAllChildren(), .FindNode() etc. Is this handled natively...
6
by: C++ Shark | last post by:
Hi, which stl class is good for creating search trees? I am looking for something flexible, that allows me to search for a required state (of matrices, graphs, etc.) quickly. thanks in...
0
by: Paul Arnold | last post by:
We are currently in the process of developing a client/server based generic tree application with which we want to be able to model and render any size, shape and depth of tree. Our primary...
1
by: Mathew Relick | last post by:
I need to generate an xml document from several datatables in a dataset which was loaded from SQL Server. There are several parent-child relationships between these tables. Thanks to some...
11
by: jova | last post by:
Is there a difference between a Binary Tree and a Binary Search Tree? If so can someone please explain. Thank You.
2
by: barnesc | last post by:
>barnesc at engr.orst.edu wrote: > > So my question is: are there any other *practical* applications of a > > B-tree based list/set/dict ? In other words, is this module totally > > worth coding,...
7
by: Bonj | last post by:
In making a ternary search tree to identify as fast as possible the type of word passed in to the algorithm, for instance sp_help -> 1 (procedures), select -> 2 (keywords), sysobjects -> 3 (system...
2
by: herbasher | last post by:
I need a few pointers. It isn't really related to C but I'm not sure where to post, and thought this group probably has really smart programmers. I need to store and manipulate a big tree...
7
by: Vinodh | last post by:
Started reading about Binary Trees and got the following questions in mind. Please help. Definition of a Binary Tree from "Data Structures using C and C++ by Tanenbaum" goes like this, "A...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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.