VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Restricts number textboxes from accepting chars.

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.


Rate Restricts number textboxes from accepting chars.



  If Not IsNumeric(Text1.Text) Then SendKeys"{BackSpace}"
End Sub

Download this snippet    Add to My Saved Code

Restricts number textboxes from accepting chars. Comments

No comments have been posted about Restricts number textboxes from accepting chars.. Why not be the first to post a comment about Restricts number textboxes from accepting chars..

Post your comment

Subject:
Message:
0/1000 characters