CMHamrick
asked on
Lock all text boxes on a form
I have a form that has several text boxes on it. I wish to LOCK all the text boxes until a certain condition s met. Is there a way to LOCK all text fields with having to lock each one by its property screen?
The boxes are all named: textFields(1) textFields(2) textFields(3), etc....
Thanks
Charlie
The boxes are all named: textFields(1) textFields(2) textFields(3), etc....
Thanks
Charlie
'use the KeyPress event.
Private Sub textFields_KeyPress(Index As Integer, KeyAscii As Integer)
If "your condition" = "criteria" Then
textFields(Index).Locked = True
End If
End Sub
S
Private Sub textFields_KeyPress(Index As Integer, KeyAscii As Integer)
If "your condition" = "criteria" Then
textFields(Index).Locked = True
End If
End Sub
S
ASKER
That did not work... error on: ctrlText ????
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'Sets .Locked=True for all TextBoxes on Form1
Dim ctrlText As TextBox
For Each ctrlText In Me.Controls
ctrlText.Locked = True
Next ctrlText
End Sub