The parenthesis are there for readability, but are not otherwise required.
I assume there is a good reason that MyArray is defined as String instead of Boolean or even Variant?
Also, if you have several TextFields that are meant to be linked to the array, either create a control set and use the TextField’s index to match it to the array, or subclass the TextField and create a field that will hold the array index. That way you can look through the controls and set that all at once, and you can add more TextFields later pretty easily.
The “=” is doing double-duty here. In the first case, TextfieldX.Visible = ..., it is working as an assignment operator. But since there can only be one assignment in a statement, any “=” (or “<”, “>”, etc.) in the statement will work as a comparison, the same as if you used it in an If statement. The comparison always returns a Boolean, so MyArray(125) = "true" compares the value of the array to the string “true” and returns either true or false.
Since the Visible property takes a boolean anyway, the result of the comparison can be directly assigned to it.
As far as doing it like Visible=(MyArray(125)=“true”), I prefer my method because I can then set other things to also equal true (like “yes”, as I mentioned) and it’s simple enough to change if the data source changes. It also prevents mistakes where you might type (MyArray(125)=“ture”) and don’t notice it.
Bill, yours is a fine, and very convenient, way to do it, but keep in mind that method calls take a toll on performance. It may not matter if you don’t use it very often, but it’s measurable in a big loop.