|
-
Jan 15th, 2002, 09:56 PM
#1
Thread Starter
Frenzied Member
Subclassing TextBox
Could someone point me to an example of subclassing a textbox? For instance, so it will block pastes, and allow only numbers. how would that be done? I know there is code to do it easily, but i would like to learn Subclassing. thanks.
You just proved that sig advertisements work.
-
Jan 15th, 2002, 10:01 PM
#2
Frenzied Member
Just do a search on subclassing.
It is bound to return enough material for hours to read.
The topic of subclassing has been mentioned countless times on this forum.
-
Jan 15th, 2002, 10:06 PM
#3
just replyed to brianh about this!
simple API to force a textbox to #'s only:
(but can still paste anything into into, sorry)
[code]Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16) 'ALTER TEXTBOX STYLES:
Public Const ES_NUMBER = &H2000 '#'S ONLY
Public Const ES_UPPERCASE = &H8& 'uppercase all
Public Const ES_PASSWORD = &H20 'stars only
'example:
'I = GetWindowLong(TXTpanel(0).hwnd, GWL_STYLE)
'r (long) = SetWindowLong(Text1.hwnd, GWL_STYLE, l Or ES_NUMBER)
-
Jan 16th, 2002, 12:49 AM
#4
Registered User
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
|