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

How do i get all the children nodes text from a treeview?

2
I am trying to get the text for each node in an existing Treeview control- including all children nodes.

I can get all the parents names (text), but not the children's..

This works for me to get the Parents text:

Expand|Select|Wrap|Line Numbers
  1.  
  2. foreach (TreeNode tn in treeView1.Nodes)
  3.             {
  4.                 richTextBox1.AppendText(tn.Text);
  5.             }
  6.  
but yet again, how can i get the children's text too?

Thanks a lot for any help!

Ray.
Aug 26 '10 #1
2 11000
Christian Binder
218 Expert 100+
Expand|Select|Wrap|Line Numbers
  1. foreach (TreeNode tn in treeView1.Nodes)
  2. {
  3.   richTextBox1.AppendText(tn.Text);
  4.  
  5.   foreach (TreeNode child in tn.Nodes)
  6.   {
  7.     // ...
  8.   }
  9. }
  10.  
Aug 26 '10 #2
RayZ
2
How didn't I think of that?

Thanks a lot!
Aug 26 '10 #3

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

Similar topics

4
by: alanrn | last post by:
I am using a TreeView to display the hierarchy of a strongly-typed collection (inherited from CollectionBase). The order of the nodes in the TreeView is strictly tied to the order in which they...
0
by: bill | last post by:
0- (nodename) text1 4 text1 4 1 |-4 (node_parentname) text2 0 text2 5 2 OK fail 3 private void button1_Click(object sender,...
0
by: usamaalam | last post by:
Hello everybody, I have a treeview control in my application and a hierarchy of sub-nodes. Application works on rights. If user doesnt have rights to see a particular screen, the treeview node...
1
by: Lanny McDonald | last post by:
I have built a treeview that looks something like: Root .....FolderLevel1a .........FolderLevel2a
12
by: EOS | last post by:
Hi, I am dynamically created TreeView and able to update/add nodes using button. The problem is nothing is being done if I was using threads. Any ideas and suggestion?
2
by: bg_ie | last post by:
Hi, I have a tree view which contains a number of nodes which correspond to a set of objects, as follows - class Address { int postCode; sting abbreviation; }
2
by: Luqman | last post by:
I have filled a treeview with parents and childs, using Hashtables. Now, how can I check the required Parent and its Child Nodes. for example, I have following data Group Item A Item A1...
1
by: =?Utf-8?B?U2VlU2hhcnA=?= | last post by:
I'm struggling on this. My goal is to add nodes programmaticaly on a 3-level tree. Unlike C#, VC++ 2003 cannot perform pointer arithmetic on TreeNodeCollection. So I cannot do something like this:...
1
by: weird0 | last post by:
Here is the code that i have been using to add nodes dynamically, but I cant see any child nodes being displayed on the treeView... all i can see the root node "Network". I have been trying to...
1
by: sunnychat | last post by:
hi. I'd like to know how to add a Plus sign ( a rectangle with a "+" inside) to the nodes in the Treeview. The nodes, currently, donot have any children (child nodes). But still I'd like the plus...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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:
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
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...

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.