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

List of all components

how do I get a list of all components on a form using reflection ??

or is there another way of doing this ??

can anyone help ??
Dec 25 '06 #1
2 1117
gusse,

What are all components on a form in your idea, normally those things have
the name controls and can be get easily in a recursive loop?


Cor

"gusse.net" <bg@gusseORNOT.netschreef in bericht
news:eP**************@TK2MSFTNGP06.phx.gbl...
how do I get a list of all components on a form using reflection ??

or is there another way of doing this ??

can anyone help ??


Dec 26 '06 #2
Hello gusse,
>how do I get a list of all components on a form using reflection ??
Assuming you are in the constructor (and I understand all kinds of missing
details about your question correctly <g>):

Type formType = this.GetType( );
FieldInfo[] fields = formType.GetFields(BindingFlags.Instance |
BindingFlags.NonPublic);
foreach (FieldInfo field in fields) {
if (typeof(Component).IsAssignableFrom(field.FieldTyp e))
Debug.WriteLine(field.Name);
}
>or is there another way of doing this ??
Is there another way of doing what?
Oliver Sturm
--
http://www.sturmnet.org/blog
Jan 2 '07 #3

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

Similar topics

2
by: Thomas Miller | last post by:
Hello, I have built a c# class library (I will call it "Assembly1"), and built an installer that installs it. It is working well. I created a new asp.net application, right-clicked on references...
7
by: Patrick De Ridder | last post by:
Below a rather simplistic example of a list view routine. Say I want to have "over" appearing in red on the display, how would I do that? Many thanks, Patrick. patrick.de.ridder@hetnet.nl...
3
by: Rico Hansen | last post by:
Hi NG! Does anyone know how to view all references in a listbox the same way when clicking the "add reference"? When clicking "add references" it's shown in a listview with Component name,...
11
by: Zorpiedoman | last post by:
The problem is this: I have a list box. I set an array list as the datasource. I remove an item from the array list. I set the listbox datasource to nothing. I set the listbox datasource to...
3
by: Zorpiedoman | last post by:
Horay! I have just put the finishing touches on a new User Control... The" Jelly Button" I created a setup program which runs fine. I see the .dll nicely in the GAC. How come it does not...
0
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another...
1
by: Aleksey | last post by:
Hi, all! Is there any standard way to get list of all components on my win form, including components that their parent isn't form it self, but panel on the form? Or to get this list I need create...
2
by: Aleksey | last post by:
Hi, all! Is there any standard way to get list of all components on my win form, including components that their parent isn't form it self, but panel on the form? Or to get this list I need create...
1
by: Wilson | last post by:
Hi, How can I get the list of web components in the page at runtime ? e.g. there is two components in the page : 1. label1 2. textbox1 I want to just the list of the above components.
0
AmberJain
by: AmberJain | last post by:
Windows Autorun FAQs: List of autostart locations Linked from the Original article- "Windows Autorun FAQs: Description". Que: Can you list all the autostart locations for windows? Ans: Here is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.