Results 1 to 4 of 4

Thread: Subclassing TextBox

  1. #1

    Thread Starter
    Frenzied Member nishantp's Avatar
    Join Date
    Jan 2001
    Location
    Where you least expect me to be
    Posts
    1,375

    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.

  2. #2
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    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.

  3. #3
    donW
    Guest
    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)

  4. #4
    Registered User Nucleus's Avatar
    Join Date
    Apr 2001
    Location
    So that's what you are up to ;)
    Posts
    2,530

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