refer to label by its name in a string

Chaseshaw

Member
Joined
Apr 21, 2010
Messages
8
Programming Experience
Beginner
Hello all. I have a string called testlabel, and would like to refer to it via the string "testlabel", how do I do this?

for instance:

dim testlabel as label
dim a as string = "test"
dim b as string = "label"

'what is the line I need here?
a & b.text = "hello world"


to get testlabel.text to read "hello world"?

thanks. I've been stuck on this all day!
 
You can't create an identifier out of strings like that. If you're specifically looking for a control then you can index the Controls collection of the form with the Name of the desired control. That will only work for controls that have a name though, so you would have had to either add the control in the designer or have set the Name property in code when you created it.
 
Back
Top