is there a way to lock just part of a text box
like let say 3 first letter of the text box
Printable View
is there a way to lock just part of a text box
like let say 3 first letter of the text box
Can you tell us more about your program. Maybe there are other way's to do the same thing.
Here You Go.
Just change the 3 to any number of characters you'd like to make write protected :)Code:Private Sub Form_Load()
Text1.Tag = Left(Text1.Text, 3)
End Sub
Private Sub Text1_Change()
If Left(Text1.Text, 3) <> Text1.Tag Then
Text1.Text = Text1.Tag & Mid(Text1.Text, 3)
Text1.SelStart = 3
End If
End Sub
Set the Textbox's MaxLength property to 3.
Or you can use this way:Code:Private Sub Form_Load()
Text1.MaxLength = 3
End Sub
Code:Private Sub Text1_Change()
If Len(Text1.Text) = 3 Then Text1.Locked = True
End Sub
tanx a lot ExcalibursZone