by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 1st December 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Use SetWindowLong API call to make a text box only accept numeric input (0-9)
API Declarations
Private Const ES_NUMBER = &H2000
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
Dim lngHwnd As Long
Dim lngReturn As Long
lngHwnd = GetWindowLong(Text1.hwnd, GWL_STYLE)
lngReturn = SetWindowLong(Text1.hwnd, GWL_STYLE, lngHwnd Or ES_NUMBER)
No comments have been posted about Use SetWindowLong API call to make a text box only accept numeric input (0-9). Why not be the first to post a comment about Use SetWindowLong API call to make a text box only accept numeric input (0-9).