This code will only accepts character from a-z or A-Z like the function IsNumeric(). It is simple a
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.
Rate This code will only accepts character from a-z or A-Z like the function IsNumeric(). It is simple a
(2(2 Vote))
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
This code will only accepts character from a-z or A-Z like the function IsNumeric(). It is simple a Comments
No comments yet — be the first to post one!
Post a Comment