how to access to a control

  • Thread starter Thread starter Altex
  • Start date Start date
A

Altex

Hi, I've got the name of a control (mycontrol3) in string format

string cotrolname = "mycontrol3";

how can I access to the control

instead of doing this
mycontrol3.Height = 100;

I'd like to do some thing like this (but in the right way)
cotrolname.Height = 100;

thanks

alex
 
Hi Alex
I don't know why don't you just use the name of the control from its
definition ??? what you have here is not a normal situation I think.
But any way , if you have access to the container of that control ;
forexample , if the control in inside a form named Form1
You can do the following .
Form1.Controls["the name you have "].
In other words , you can access it , using the name , through the Controls
collection of the container control
Hope that helps

Mohamed Mahfouz
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
 
Back
Top