How to create a pointer to a property using the property's name?

Basically I want to do something like this…

For i = 1 to x
    ptrToLabelProperty = createPointerFromString("myProperty" + Str(i))
    ptrToLabelProperty.Text = "xxxxx_"+Str(i)
Next

Can’t find any discussion in the docs that I recognize as doing what I want.

Thanks.

Get a reference to the control / class instance that holds the property
Set the property on the instance

You might use introspection for obtaining that

Three possibilities:

If all labels are already existing (= added in the window editor at development time):

Dim counter As Integer = 1 For i As Integer = 0 To ControlCount - 1 If Control(i) IsA Label And Control(i).Name.Left(10) = "myProperty" Then Dim lbl As Label = Label(Control(i)) lbl.Text = "xxxxx_" + Str(counter) counter = counter + 1 End Next

If you want to add labels at runtime have a look at “control sets”.

Or use introspection.

@Eli Ott

First Off I should have posted this to the web forum. The sample code should have reflected that as well and been more specific. My apologies.

Eli, your answer got me pointed in the right direction. Here is what I have working now with a more scecific code snippet.

For i = 0 to x.
    Dim myLabel As WebLabel = WebLabel(me.ControlWithName("label"+Str(i) ))
    myLabel.Text = "xxxxx_"+Str(i)
Next

That is a really over simplified snippet of what I am trying to do. ControlWithName in essence does exactly what I was looking for.

Thanks.