Results 1 to 7 of 7

Thread: only allow letters and space and backspace into text box

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    how do I do it?
    NXSupport - Your one-stop source for computer help

  2. #2
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196
    i saw an article either on this site or VB API once about how to use the api to make a text box accept numbers only. So i think there's probably a similar thing that you can do to make it accept alphabetics only...

    I'll have a look around and let you know if i find it - but at least you know that a solution is floating around out there somewhere...

  3. #3
    Guest
    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        Select Case KeyAscii
            Case 8 ' backspace
            Case 65 To 90 'A-Z
            Case 97 To 122 'a-z
            Case Else
                KeyAscii = 0
        End Select
    End Sub
    [Edited by denniswrenn on 08-21-2000 at 09:33 PM]

  4. #4
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Add a Case 32 to Dennis' code for the blank space:
    Code:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        Select Case KeyAscii
            Case 8 ' backspace
            Case 65 To 90 'A-Z
            Case 97 To 122 'a-z
            Case 32 'blank space
            Case Else
                KeyAscii = 0
        End Select
    End Sub
    "It's cold gin time again ..."

    Check out my website here.

  5. #5
    Guest

    Red face Oops!

    I did remember to accept the space key, but I accidently deleted it for some reason

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    ok, thanks to both for your help and time, and good luck with your campain dennis
    NXSupport - Your one-stop source for computer help

  7. #7
    Banned
    Join Date
    May 2014
    Location
    OH
    Posts
    459

    Re: only allow letters and space and backspace into text box

    i tried without case 97 but case 65 doesn't work without for some reason

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