Results 1 to 2 of 2

Thread: Force Capitalization in all Textboxes on Form

  1. #1

    Thread Starter
    Hyperactive Member johnweidauer's Avatar
    Join Date
    Sep 2002
    Location
    SLC, UT
    Posts
    314

    Post Force Capitalization in all Textboxes on Form

    Code:
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    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 WS_MINIMIZEBOX = &H20000
    
    'edit styles used
    Private Const ES_UPPERCASE As Long = &H8&
    Private Const ES_LOWERCASE As Long = &H10&
    Private Const ES_NUMBER    As Long = &H2000
    
    Private Sub Form_Load()
      Dim lngStyle As Long
      Dim ctl As Control
      
      For Each ctl In Controls
        If TypeOf ctl Is TextBox Then
          lngStyle = GetWindowLong(ctl.hwnd, GWL_STYLE)
          Call SetWindowLong(ctl.hwnd, GWL_STYLE, lngStyle Or ES_UPPERCASE)
        End If
      Next
    
    End Sub

  2. #2
    Member
    Join Date
    Mar 2005
    Posts
    47

    Re: Force Capitalization in all Textboxes on Form

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width