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

How to populate TreeView with controls from Form?

I've figured out how to enumerate through all the controls in a form
(code below) However, how would I populate the TreeView with control
names in correct hierarchial order?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim c As Control
TreeView1.BeginUpdate()
TreeView1.Nodes.Clear()
For Each c In Me.Controls
iterate(c)
Next
TreeView1.EndUpdate()
End Sub

Private Sub iterate(ByVal c As Control)
TreeView1.Nodes.Add(c.Name) ' adds all the controls w/o
hierarchy
If c.Controls.Count = 0 Then
Exit Sub
End If
Dim ctl As Control
For Each ctl In c.Controls
iterate(ctl)
Next
End Sub
End Class
Nov 21 '05 #1
1 1134
Figured it out

no*****@yahoo.com (*no spam*) wrote in message news:<34**************************@posting.google. com>...
Nov 21 '05 #2

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

Similar topics

0
by: T.H.M | last post by:
This is the all code. Very simple and short. I need to populate a treeView in aspx page (web form) from XML file. I get en completion error:No overload for method 'TreeNode' takes '1' arguments ....
3
by: Steve | last post by:
Visual Studio 2003 .NET / C# I have a treeview object on a form which acts as the main menu controller for my application. the treeview is always in sight, and the form it is on acts as the...
1
by: Oliver | last post by:
I have seen mention of TreeView controls in other threads, but cannot find information about these in the Online Help. I feel that I might be missing out on some useful functionality. How can I...
6
by: Jarod_24 | last post by:
This is the exception i'm getting: System.InvalidOperationException: The action being performed on this control is being called from the wrong thread. You must marshal to the correct thread using...
9
by: Marina | last post by:
Hello! I have a database with some customers. Each one of them has 3 other customers under him etc. (something like an MLM system). Now, I want to create a treeview with this. Eg. C1 C11...
2
by: Dave Wurtz | last post by:
All, I have a treeview on my form that has a lot of nodes on it. I would like to populate this treeview on another thread so my form will still paint while it is being populated. I have...
2
by: dixiecanterbury | last post by:
I have a tree view on a form and I need to pass that treeview to another form keeping the state of the treeview (expanded nodes, etc). After the treeview has been manipulated (added nodes,...
6
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...
0
by: xmail123 | last post by:
How to populate a treeview from a dataset I am very new to C#. I need to create a Windows form that will read a SQL table and populate a treeview. I can connect to the DB, create the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.