Make your own free website on

[an error occurred while processing this directive]
'This project needs a TextBox
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
Const GWL_STYLE = (-16)
Const ES_NUMBER = &H2000&
Public Sub SetNumber(NumberText As TextBox, Flag As Boolean)
    Dim curstyle As Long, newstyle As Long

    'retrieve the window style
    curstyle = GetWindowLong(NumberText.hwnd, GWL_STYLE)

    If Flag Then
     curstyle = curstyle Or ES_NUMBER
     curstyle = curstyle And (Not ES_NUMBER)
    End If

    'Set the new style
    newstyle = SetWindowLong(NumberText.hwnd, GWL_STYLE, curstyle)
End Sub
Private Sub Form_Load()
    'KPD-Team 1999
    SetNumber Text1, True
    Me.Caption = "Now, try typing some letters into the textbox"
End Sub

Copyright © 1998-2000, The KPD-Team.
Send mail to with comments about this web site.
This site is located at