Basically I want to do something like this…
For i = 1 to x
ptrToLabelProperty = createPointerFromString("myProperty" + Str(i))
ptrToLabelProperty.Text = "xxxxx_"+Str(i)
Can’t find any discussion in the docs that I recognize as doing what I want.
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
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
If you want to add labels at runtime have a look at “control sets”.
Or use introspection.
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)
That is a really over simplified snippet of what I am trying to do. ControlWithName in essence does exactly what I was looking for.