If you have a reference to the System.Windows.Forms assembly you can use:
object o = Activator.CreateInstance(typeof(System.Windows.For ms.Control));
If you don;t you need to use:
Type t = Type.GetType("System.Windows.Forms.Control, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
object o = Activator.CreateInstance(t);
Incidently its a bit unusual to want to create aninstance of the base Control class, what are you trying to do
Regards
Richard Blewett - DevelopMentor
http://staff.develop.com/richardb/weblog
Hi All
I need to create a windows form control(from System.Windows.Forms.dll
assembly) dynamically using Activator.How do I achieve this?Sample code is
much more helpful.
Thanks in advance
Regards
Krishna