Click to See Complete Forum and Search --> : TextBox's case style
Rippin
February 21st, 2000, 10:37 AM
I know how to set a TextBox to only accept upper/lower case characters by using the SetWindowLong API and changing the ES_UPPERCASE or ES_LOWERCASE styles. My problem is...how do I change the textbox back to "normal" (accept both UCase AND LCase)? Any help is appreciated.
Thanx,
Rippin
Rippin
February 21st, 2000, 10:50 AM
Nevermind, I figured it already. In case anyone else is having this problem, here is the code:
'Declarations/constants
'
Const ES_UPPERCASE = &H8&
Const ES_LOWERCASE = &H10&
Const GWL_STYLE = (-16)
'
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
'
'
'Here's the code.
'
Dim lngStyle as Long
Dim lngReturn as Long
'
'get the current style.
lngStyle = GetWindowLong(Text1.hWnd,GWL_STYLE)
'
'Change the style.
lngStyle = lngStyle Or (ES_UPPERCASE And ES_LOWERCASE)
'
'Update the textbox with the new style.
lngReturn = SetWindowLong(Text1.hWnd,GWL_STYLE,lngStyle)
Rippin
Rippin
February 21st, 2000, 11:21 AM
Oops, spoke too soon (as usual). My problem still exists, I only "thought" it worked. The code I showed in my last post actually does nothing (or does something that isn't noticeable). So I thought it was working, until I set a textbox to uppercase only THEN set it back to "normal"...it don't work. Any help is...well , you know.
Rippin
Kyle Burns
February 21st, 2000, 12:58 PM
Generally when you combine arguments in API calls, you OR them together instead of AND.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.