Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Numeric Textbox
Message
Information générale
Forum:
Visual Basic
Catégorie:
Fonctions API de Windows
Titre:
Divers
Thread ID:
00272280
Message ID:
00272410
Vues:
33
>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

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform