I have, say, 10 labels, named Label1, Label2, ... Label10. What I want to do, in terms of pseudocode is to perform such a loop, where X is a value between 1 and 10:
For i = 1 to 10
If i < X Then
LabelX.Text = "Yes"
LabelX.Text = "No"
In order to translate the LabelX part to valid code, the first method I decided to use was to do it like:
Execute ("Label" & X & ".Text = ""Yes""")
However, Execute is not available in VB (it is in VBS and ASP.) The other method is to loop through Me.Controls as described here (http:Q_21036782.html
). Or perhaps creating an array of the Labels could be an alternative, but an array does not contain the Labels byref, or at least I don't know how to make it do. (The benefit was I didn't have to go through ALL the controls available to only find those 10 Labels.)
What is your opinion?