CodeItBetter Programming Another VB Programming Blog

How to uppercase the text entered in text box using API

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'Controls - How to uppercase the text entered in text box using API
Option Explicit
 
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, _
    ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, _
    ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const GWL_STYLE = (-16)
Private Const ES_UPPERCASE = &H8&
 
Private Sub Form_Load()
    Dim style As Long
 
    ' Get the current style.
    style = GetWindowLong(Text1.hWnd, GWL_STYLE)
 
    ' Add ES_UPPERCASE to the style.
    SetWindowLong Text1.hWnd, GWL_STYLE, style Or ES_UPPERCASE
End Sub
Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.