L/UCaseKeyPress
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
Use these functions in KeyPress events to format user entries as entry is typed. UCaseKeyPress() converts key pressed to uppercase while LCaseKeyPress() converts key pressed to lowercase.
Original Author: Edmundo T. Mendiola
Inputs
KeyAscii As Integer
The ASCII value of key pressed; parameter from KeyPress event.
Assumptions
These two functions are easily re-usable in any projects where form controls with KeyPress events exists. You may also use this function in situations where the equivalent upper or lower case ASCII value of a character is to be evaluated.
Returns
Returns the new value of KeyASCII to be returned by the KeyPress event.
Code
Public Function LCaseKeyPress(ByRef KeyAscii As Integer) As Integer
' Useful in the KeyPress event to convert entry to LCase()
LCaseKeyPress = Asc(LCase(Chr(KeyAscii)))
End Function
Public Function UCaseKeyPress(ByRef KeyAscii As Integer) As Integer
' Useful in the KeyPress event to convert entry to UCase()
UCaseKeyPress = Asc(UCase(Chr(KeyAscii)))
End Function
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.