by Gulzar (3 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 15th March 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Restrict the Entry of Textbox data to Numeric Fields.
API Declarations
Useful Code
Paste the Code in the Text Box's Key Press Event.
It check for the Key which is pressed if it 0 to 9 it allows the Entry others not Allowed. Its also allows the Back space to delete text backwards if there is some mistake.
If KeyAscii < 48 Or KeyAscii > 57 Then
If KeyAscii <> 8 And KeyAscii <> 13 Then
KeyAscii = 0
End If
End If
End Sub