Jobs
Author: Ulysses R. Gotera Date Submitted: 7/29/2005 Category: Microsoft Controls Compatibility: VB 6,VB 5 This code has been accessed 3319 times.
Email Yourself this snippet:
' Need a code to change all your keyed in letters to upper case ' with out the user pressing the Caps Lock key? ' ' Then add the code below to your BAS file. ' ' Sample Usage: 'Private Sub Textbox1_KeyPress(KeyAscii As Integer) ' OnlyUpperCase KeyAscii 'End Sub
Code
Public Sub OnlyUpperCase(ByRef p_intKeyAscii As Integer, _ Optional Byval p_blnNoSpaces As Boolean) ' ************************************************** ' Description : Changes lower case letters to upper case. ' The user does not need to press the Caps Lock key. ' An additional feature is that if you do not want any space ' in your textbox entries then just ' set the second parameter to true. ' Author : Ulysses R.Gotera ' e-mail : urgotera@yahoo.com ' Date Created : Friday, July 01, 2005 ' ************************************************** If p_blnNoSpaces And (p_intKeyAscii = vbKeySpace) Then p_intKeyAscii = 0 Exit Sub End If End If If (p_intKeyAscii > 96) And (p_intKeyAscii < 123) Then p_intKeyAscii = p_intKeyAscii - 32 End If End Sub