473,396 Members | 2,029 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.

How to get all control names and atributes from a form at runtime

Hi,

I want to Get all controls names, some properties, etc... from a form at runtime.
Anyone knows how can i enumerate all controls from a form?

Thanks for your help,

Nov 15 '05 #1
3 1936

System.Windows.Forms.Control.ControlCollection = Control.Controls

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode with Nostalgia enabled
Nov 15 '05 #2
Hi,

this is in the server or in the client?

If in the server you can use the Controls collection, but be aware, you need
to do a deep search of it, as each control inside this collection can have
controls itself. !!!

something like this:

void iteratecontrol( ControlCollection controls)
{
foreach( Control current in controls)
{
UseCurrentControl( current );
//Iterate in the children
iteratecontrol( current.Controls);
}
}
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Bernardo" <bp****@sapo.pt> wrote in message
news:F3**********************************@microsof t.com...
Hi,

I want to Get all controls names, some properties, etc... from a form at runtime. Anyone knows how can i enumerate all controls from a form?

Thanks for your help,

Nov 15 '05 #3
in the form's class

foreach(Control ctl in this.Controls)
{
System.Diagnostics.Debug.WriteLine( ctl.Name);
...
}

Or, to get everything nested in a GroupBox called OptionsGroup,
foreach(Control ctl in OptionsGroup.Controls)
{
System.Diagnostics.Debug.WriteLine( ctl.Name);
...
}


"Bernardo" <bp****@sapo.pt> wrote in message
news:F3**********************************@microsof t.com...
Hi,

I want to Get all controls names, some properties, etc... from a form at runtime. Anyone knows how can i enumerate all controls from a form?

Thanks for your help,

Nov 15 '05 #4

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

Similar topics

0
by: don | last post by:
hello all, msdn says this about using a dotnet windows control library in activex environment... You have to write one relatively small piece of code to make your .NET control accessible to...
4
by: Horatiu Ripa | last post by:
1. I have an image list defined in a control 2. I want to expose trough properties the image list in a manner to be able to change it from the container where the control is used. How do I do...
4
by: Randy | last post by:
Hi, ok, I found a way to connect to a running instance of an (external) Internet Explorer and access - for example - the html source. That works fine! But now I have running application with...
2
by: Tamarack | last post by:
I have a simple function which loops through all the controls on a form searching for a specific one: Public Function FindControl(ByVal ctrls As Control.ControlCollection, ByVal ctrlName As...
2
by: Tom Shelton | last post by:
I was goofing around tonight and decided to write a little IP address control. I had written a simple one a long time ago, but I decided I should try to write one that was half way correct :) ...
0
by: Seok Bee | last post by:
Dear Experts, I am having a wizard control in my web app. I have some textbox controls within the wizard control. At the same time, I have a hyperlink to run a pop-up window for calendar. The...
1
by: aps-asia | last post by:
I have one WinForm and 3 buttons on this form. all buttons are private. I set the button2's click event to execute the "Controls.RemoveByKey("button1");". When I executed the button2's click...
5
by: Guillaume BRAUX | last post by:
Hello, What I want to do is to add a userControl to a form class witch is a different class from the one the button is generated. For example, I want to instanciate a label in "class1" and add...
3
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a...
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?
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
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.