dynamically accessing control list of a form in dll controllibrary

  • Thread starter Thread starter Ahmet
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top