What's Here?
- Members: 300,354
- Replies: 825,775
- Topics: 137,423
- Snippets: 4,418
- Tutorials: 1,147
- Total Online: 1,797
- Members: 119
- Guests: 1,678
|
This snippet will only allow the user to input letters in a textbox
|
Submitted By: birdflu9999
|
|
|
Rating:
|
|
Views: 218 |
Language: Visual Basic
|
|
Last Modified: July 3, 2009 |
Instructions: 1. add the function to a module or to your form
2. you must use it under the event "KeyPress" of a textbox
3. it will look like this:
Private Sub Text1_KeyPress(KeyAscii As Integer)
LettersOnly KeyAscii
End Sub
|
Snippet
Function LettersOnly(KeyAscii As Integer)
Select Case KeyAscii
Case Asc("a") To Asc("z")
Case Asc("A") To Asc("Z")
Case Str(32) 'Space
Case Str(13) 'Enter
Case Str(8) 'Backsapce
Case Str(164) 'ñ
Case Str(165) 'Ñ
Case Else
KeyAscii = 0
End Select
End Function
Copy & Paste
|
|
|
|