creating object from string...

  • Thread starter Thread starter Grisha0
  • Start date Start date
G

Grisha0

Hi,
i've got a little question.
I'd like to create an object for example TextBox
normaly it'd like look like this:
TextBox my_Object = new TextBox();

but i'd like to get the name of the instance from a string.

string name = "my_object_name_from_string";
TextBox name = new TextBox();

any ideas how to do such a thing ? is it possible ??
 
Grisha,

You make me curious, what is the sense of your question.
You can give your textbox an external name setting the "text" property to a
string, however what is the sense giving a textbox an internal name from a
string, which will never be seen by a user.

Just curious, because you must have a reason.

Cor
 
i'm trying to create an interface stored in a database in form of strings.
a client application is connecting to the DB.
Getting information (strings) about interface.
with this information is is creating whole interface :D

so the someobject.name is not enough ... i can do it this way but it
will look stupid and i don't like it :]

i'd like to get a string from db like
'TextBox/my_textbox/100/20'

and with such info create
one object of TextBox class
with usable in further programing name of my_textbox.
using it like my_textbox.text = 'blah blah blah';
and parameters ... width 100
height 20
 
Grisha,

With dynamicly creating an array of controls, you keep having early binding,
for that you can use an array too the indexes, by instance an hashtable, in
my opinion much more efficient than trying to create an object directly from
a string.

However just my thought,

Cor
 
Back
Top