andyw27
asked on
changing multiple controls with a single line of code
Hello,
Say I have the following controls on a form:
textbox1
textbox2
textbox3
textbox4
Whats is the most efficient way to set the enable value to false ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
how do you refer to the collective in a control array?
for example text1(0) refers to the first one, is there a way (other than some kind of loop) to influence all members of the control array?
Its not possible in single line and without using loop to change all the control's property.
another option is to create a control array of the 4 textboxes, each having the same name but a different index value.
you can then loop through (assuming you name the control textbox with index values from 0 to 3):
dim l as long
for l = textbox.lbound to textbox.ubound
textbox(l).enabled = false
next