I have a set of text boxes on a form that I want to be able to lock/unlock at well (ie. user cannot edit text unless permitted).
In VB6 I would simply set the Locked property to True and be done.
In VB 2005, the Locked property is for design time only, and prevents controls from being moved accidentally during form design. Then I found the ReadOnly property and thought it should work.
Here's what I've tried to lock the TextBoxes, but it's not working:
Private Sub LockFields(ByVal Lock As Boolean)
For Each ctrl As Control In Me.Controls
If TypeOf ctrl Is TextBox Then
ctrl.ReadOnly = True
It fails with this error in the Error List.
'readonly' is not a member of 'System.Windows.Forms.Control'.