Hi Yoshi,
Your question is not very clear...:(
Are you trying to find out the control with the name as specified in the
'name' string variable?
Ans: Iterate thru the controls listed in the form's Controls
collection....for each of them check whether the name property is equal to
'name' string. If yes, cast it to a Label and do your implementation.
Or are you simply trying to assign the value of the variable 'name' to the
Label control 'l'?
Ans: l.Text = name
HTH,
- Rakesh
"Yoshi" wrote:
Let's say that I have the following:
String name = "lblDescription";
The string assigned to the name variable is actually a label control on my
form with that name. Is there away in C# to the name and "cast" it to the
actual label control with that name?
Label l = (Label) name;
I know it doesn't work but can it be done?
Thanks,
Yosh