Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Numeric Textbox
Message
General information
Forum:
Visual Basic
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00272280
Message ID:
00272410
Views:
32
>Do you remember the API call to force a textbox to accept numerical values only?
>
>-OR-
>
>What is your best/favorite way of dealing with numerical entries (other than buying FarPoint's Input Pro and the like)?

No API needed simply kill the key stroke before its updated like so. Add a text box named txtYourText or rename the code below.
Private Sub TxtYourText_KeyPress(KeyAscii As Integer)
    'Numbers only
    If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0 ' numbers
    'Text only (Uncomment both to allow text and numbers)
    'If KeyAscii < 65 Or KeyAscii > 122 Then KeyAscii = 0 'letters
End Sub
HTH
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Previous
Reply
Map
View

Click here to load this message in the networking platform