dynamically accessing control list of a form in dll controllibrary

A

Ahmet

Hi;

How can I get control list (Controls[]) of a form in a dll dynamically
activated using Activators.CreateInstance.
I need all controls names and attributes of one form which is in one dll.
Is it possible to do this ?

thanks in advance.
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hi Ahmet,

You can do that using Reflection. Iterate on all types in the assembly in
question and check each type for having the System.Windows.Forms.Control as
its ascendant.
 
C

CJ Taylor

To add what dmitriry is saying...

Use the shared function of LoadFile (or whatever load you want) from
the System.Reflection.Assembly class

Iterate through Assembly.getTypes()

Also, check for the base type on most, because a lot of times you get
RuntimeMethod instead of method. but a runtime methods base type is
Method...

Just a little FYI.

-CJ

Dmitriy Lapshin said:
Hi Ahmet,

You can do that using Reflection. Iterate on all types in the assembly in
question and check each type for having the System.Windows.Forms.Control as
its ascendant.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Ahmet said:
Hi;

How can I get control list (Controls[]) of a form in a dll dynamically
activated using Activators.CreateInstance.
I need all controls names and attributes of one form which is in one dll.
Is it possible to do this ?

thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top