That's where reflection comes in:
using System.Reflecti on;
string className = "System.Windows .Forms.TextBox" ;
Type classType = Type.GetType(cl assName, false);
ConstructorInfo constructor = classType.GetCo nstructor(new Type[0]); //
Assuming you want to use the default constructor
object newInstance = constructor.Inv oke(new object[0]); // Again assuming
you're using the default constructor
Now you can cst newInstance to the required object to access the methods /
properties you need.
Hope this helps.
Jako Menkveld
"Sahil Malik" <co************ *****@nospam.co m> wrote in message
news:u%******** ********@TK2MSF TNGP15.phx.gbl. ..
Lets say .. I get a string ..
"System.Windows .Forms.TextBox"
Can I instantiate an instance of that .. given that the ONLY information I
have is that string above i.e. classname?
To make things easy, such a classname is in GAC.
- Sahil Malik
http://codebetter.com/blogs/sahil.malik/