Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting a string into a Control object name

Status
Not open for further replies.

Alsa1980

Programmer
Jul 11, 2006
5
GB
Hi all.

I need to retrieve the name of a Control object (i.e a textbox) from a class object as string, and then manipulate that object using the usual methods but i seem to lack the exact way of doing this.

Example:

string objectName = newObjectAttributes.getName();

myForm.objectName.Location = newObjectAttributes.getPoint();

I've tried casting the string but, basically I don't have c# experience yet to do this easily.
Any help would be appreciated, I have googled the problem to no avail.
 
Why don't you have the object return a reference to the textbox, then you can just manipulate it without an issue?

----------------------------------------

TWljcm8kb2Z0J3MgIzEgRmFuIQ==
 
without going into too much detail, i have an XML form with around 600 entries which describe the name, size, location of the object

having got the name of the object from the XML form, i just need some way to use that in my statement as i would normally use:

commentForm.commentsTextBox.Location.. etc

in need to use (from what i can see)

string s = objectOfStoredXmlInfo.getName() singleObject.s.commentsTextBox.Location..etc

if i am missing the point please let me know, i am quite new to c#

 
I did what you suggested Guru7777 and it solved my problem, I guess I needed to take a breather and look at the problem from another angle. thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top