A
Alex D.
Hi guys. I am trying to create a specific object calling its constructor
based on a string containing the name of the object. Let say I have three
objects A, B, and C. Also let say I let the user enter a text in a textbox.
If the user enters 'A' or 'B' I want to do this
if (TextBox1.Text == 'A')
object O = new A();
if (TextBox1.Text == 'B')
object O = new B();
.....and so on.
Since at design time I dont know what objects I have I need to do this in a
generic and dinamic way...is there any way?? I hope so!
Any help would be great.
Thanks,
Alex.
based on a string containing the name of the object. Let say I have three
objects A, B, and C. Also let say I let the user enter a text in a textbox.
If the user enters 'A' or 'B' I want to do this
if (TextBox1.Text == 'A')
object O = new A();
if (TextBox1.Text == 'B')
object O = new B();
.....and so on.
Since at design time I dont know what objects I have I need to do this in a
generic and dinamic way...is there any way?? I hope so!
Any help would be great.
Thanks,
Alex.