|
-
February 21st, 2000, 11:37 AM
#1
TextBox's case style
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
-
February 21st, 2000, 11:50 AM
#2
Re: TextBox's case style
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
-
February 21st, 2000, 12:21 PM
#3
Re: TextBox's case style
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
-
February 21st, 2000, 01:58 PM
#4
Re: TextBox's case style
Generally when you combine arguments in API calls, you OR them together instead of AND.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|