-
In my program I have around 20 text boxes with different names. I want a simple statements where I can enable and disable all of them. The program requires me not to use linked text boxes.
text boxes are named txtName, txtAddress, txtPhone....
the code by Mr.Gates works great. Thanks again for the help and if anyone wants to use this code just paste it from here and add an end if statement after the if statement.
[Edited by xstopx81 on 08-01-2000 at 02:59 PM]
-
Code:
Public Sub DisableTBs(frmName As Form)
Dim MyControl As Control
For Each MyControl In frmName.Controls
If TypeOf MyControl Is TextBox Then MyControl.Enabled = False
Next
End Sub
Public Sub EnableTBs(frmName As Form)
Dim MyControl As Control
For Each MyControl In frmName.Controls
If TypeOf MyControl Is TextBox Then MyControl.Enabled = True
Next
End Sub