Can anyone tell me how to to create a control instance dynamicly.
Example:
When I have a string value with the value 'TextBox'. I want to create a
TextBox instance.
I know that i can do the folowing: TextBox tb = new TextBox();
Now i've created a method that translates the string value:
fucntion CreateControl(string controlTypeName)
{
switch (controlTypeName)
{
case "Label":
return new Label();
case "TextBox":
return new TextBox();
}
}
but there must be a simpler way more generic way to do this.
Regards,
Jelle van Baardewijk