Need help in object creation

  • Thread starter Thread starter sunil
  • Start date Start date
S

sunil

I am creating an object of a button class
using the following code.
System.Windows.Forms.Button b=new
System.Windows.Forms.Button();

My requirement is i will acccept as a user input a fully
qualified class name like (ex:-System.Windows.Forms.Button)
How to create object of the class entered by the user.The
class name is not hard coded in my application.

Is it possible...
Please specify with an example...
 
My requirement is i will acccept as a user input a fully
qualified class name like (ex:-System.Windows.Forms.Button)
How to create object of the class entered by the user.The
class name is not hard coded in my application.
use System.Activator class
Is it possible...
Please specify with an example...

System.Activator.CreateInstance(Type.GetType(typeNameThatUserEntered));
 
Back
Top