CodeItBetter Programming Another VB Programming Blog

How to Check the Type of Character

Posted on January 5, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
'String Manipulation - How to Check the Type of Character

'To check whether a character is upper, lower, alpha or numeric using API.

Declare Function IsCharUpper Lib "user32" Alias "IsCharUpperA" (ByVal cChar As Byte) As Long
Declare Function IsCharLower Lib "user32" Alias "IsCharLowerA" (ByVal cChar As Byte) As Long
Declare Function IsCharAlpha Lib "user32" Alias "IsCharAlphaA" (ByVal cChar As Byte) As Long
Declare Function IsCharAlphaNumeric Lib "user32" Alias "IsCharAlphaNumericA" (ByVal cChar As Byte) As Long
 
Private Sub Text1_KeyPress(KeyAscii As Integer)
    MsgBox "Upper Case: " & IsCharUpper(KeyAscii) & " Lower Case: " & IsCharLower(KeyAscii) & _
           " Alpha: " & IsCharAlpha(KeyAscii) & " Alpha or Numeric: " & IsCharAlphaNumeric(KeyAscii)
End Sub
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.