Results 1 to 5 of 5

Thread: Stupid Question?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    Question

    How do I limit textbox only to accept text w/o using maskedcontrol?
    Remaining quiet down here !!!

    BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....

  2. #2
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    Im not sure what you want.
    Please explain.

    Do you want only certain
    letters to appear that
    are typed?

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If IsNumeric(Chr(KeyAscii)) Then KeyAscii = 0
    End Sub
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Frenzied Member sebs's Avatar
    Join Date
    Sep 2000
    Location
    Aylmer,Qc
    Posts
    1,606

    keypress

    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii > 49 And KeyAscii < 57 Then KeyAscii = 0
    End Sub

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Use this to only accept numbers
    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii < 33 Then Exit Sub
    If Not (IsNumeric(Chr(KeyAscii))) Then KeyAscii = 0
    End Sub

    And this just to tease people
    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii < 33 Then Exit Sub
    If KeyAscii Mod 2 = 0 Then KeyAscii = 0
    End Sub
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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