For example, I want a string containing the "System.Windows.Forms.Button"
information to return a New Button()
button object, would that be possible?
Note: It has the C # tag as it is easy to translate from C # to Visual Basic
For example, I want a string containing the "System.Windows.Forms.Button"
information to return a New Button()
button object, would that be possible?
Note: It has the C # tag as it is easy to translate from C # to Visual Basic
Use the CreateInstance
function, informing you all the way to the class:
var obj = Activator.CreateInstance(Type.GetType("System.Windows.Forms.Button"));
You can also use a cast in the variable's creation for a class that you are sure is the parent of the one you are creating, for example:
var obj = (Control)Activator.CreateInstance(Type.GetType("System.Windows.Forms.Button"));
This way you can use the functions of class Control
easily.