Results 1 to 5 of 5

Thread: Not all of it!!!

  1. #1

    Thread Starter
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606

    Arrow

    is there a way to lock just part of a text box

    like let say 3 first letter of the text box

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Can you tell us more about your program. Maybe there are other way's to do the same thing.

  3. #3
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    Here You Go.

    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
    Just change the 3 to any number of characters you'd like to make write protected
    -Excalibur

  4. #4
    Guest
    Set the Textbox's MaxLength property to 3.

    Code:
    Private Sub Form_Load()
    Text1.MaxLength = 3
    End Sub
    Or you can use this way:

    Code:
    Private Sub Text1_Change()
    If Len(Text1.Text) = 3 Then Text1.Locked = True
    End Sub

  5. #5

    Thread Starter
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606

    that's genius

    tanx a lot ExcalibursZone

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width