Module modNumericBox
Private Const ES_NUMBER As Integer = &H2000
Private Const GWL_STYLE As Integer = -16
<System.Runtime.InteropServices.DllImportAttribute("user32.dll", SetLastError:=True)> _
Private Function GetWindowLong(ByVal hwnd As IntPtr, ByVal nIndex As Integer) As Integer
End Function
<System.Runtime.InteropServices.DllImportAttribute("user32.dll", SetLastError:=True)> _
Private Function SetWindowLong(ByVal hwnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
End Function
Public Sub SetTextBoxNum(ByRef Obj As Object)
If (TypeOf Obj Is System.Windows.Forms.TextBox) Then
SetWindowLong(Obj.Handle, GWL_STYLE, GetWindowLong(Obj.Handle, GWL_STYLE) Or ES_NUMBER)
End If
End Sub
End Module