by James Olarte (8 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 14th December 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
This code will only accepts character from a-z or A-Z like the function IsNumeric(). It is simple and easy to use.
API Declarations
'Please include a textbox to test this code.
'You can use it for validations, etc.
'Basically, this code will validate any character that was inputted in a
'textbox or any object that has a Keydown,Keypress or Keyup events.
'Feel free to maximize the usage of this code.
On Error GoTo ErrorHandler:
If CharCode > 96 And CharCode < 123 Then
CharacterIsAlpha = True
ElseIf CharCode > 64 And CharCode < 91 Then
CharacterIsAlpha = True
Else
CharacterIsAlpha = False
End If
Exit Function
ErrorHandler:
MsgBox "Error: " & Err.Description, vbCritical + vbOKOnly, "Error " & Err.Number & " in CharacterIsAlpha!"
End Function
Private Sub Text1_KeyPress(KeyAscii As Integer)
If CharacterIsAlpha(KeyAscii) = False Then
MsgBox "String contains a numeric character(s)"
End If
End Sub
No comments have been posted about This code will only accepts character from a-z or A-Z like the function IsNumeric(). It is simple a. Why not be the first to post a comment about This code will only accepts character from a-z or A-Z like the function IsNumeric(). It is simple a.