Advertisement
3_2004-2005 Windows API Call/ Explanation #141141

Numeric Style Textbox

From CShellVB http://www.cshellvb.com Change the style of a normal textbox so that it will only accept numbers. Better then evaluating keypress events and very fast. This call works on the fly and it is wrapped into a function for you.

AI

Ringkasan AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Kode Sumber
original-source
'This function changes the style based on the flag
Public Sub SetNumber(NumberText As TextBox, Flag As Boolean)
Dim curstyle As Long
Dim newstyle As Long
'This Function uses 2 API functions to set the style of
'a textbox so it will only accept numbers CShell
curstyle = GetWindowLong(NumberText.hwnd, GWL_STYLE)
If Flag Then
  curstyle = curstyle Or ES_NUMBER
Else
  curstyle = curstyle And (Not ES_NUMBER)
End If
newstyle = SetWindowLong(NumberText.hwnd, GWL_STYLE, curstyle)
NumberText.Refresh
End Sub
Komentar Asli (3)
Dipulihkan dari Wayback Machine