Results 1 to 5 of 5

Thread: [Resolved] Preventing Keystrokes

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    8

    Resolved [Resolved] Preventing Keystrokes

    Allright, Im programming a MMORPG, I dont want Numbers Nor Spaces in the Name. So, I set this up;

    Code:
    Private Sub txtName_KeyPress(KeyAscii As Integer)
    Dim ch As String
          
        ch = Chr$(KeyAscii)
        If Not ( _
            (ch >= "a" And ch <= "z") Or _
            (ch >= "A" And ch <= "Z") _
        ) Then
            ' Cancel the character.
            KeyAscii = 0
        End If
    End Sub
    Works exactly how I wanted,But Wait, I can't backspace now. So, Does anyone know how I could make it allow the backspace key?
    Last edited by wisefire; Sep 21st, 2007 at 09:59 PM.

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