by Chris Onyishi (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 10th December 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Restricts number textboxes from accepting chars.
API Declarations
'When we enter data through the keyboard, the char entered is stacked in the
'keyboard buffer and the buffer pointer is incremented. This code
'uses "IsNumeric" - whenever there is change - to check if the contents of the
'buffer is all numeric. If it is not, "SendKeys" is used to send backspace
'which robs off the char from the buffer by decrementing the buffer pointer and
'if the PC is very fast, Pentium 4, the user gets the feeling that nothing was
'pressed.
If Not IsNumeric(Text1.Text) Then SendKeys"{BackSpace}"
End Sub