Visual Basic > Forms
Limit input in a textbox to certain characters
Limit input in a textbox to certain characters Function LimitTextInput(source) as String 'put the next line in the Textbox_KeyPress event 'KeyAscii = LimitTextInput(KeyAscii) 'change Numbers with any other character Const Numbers$ = "0123456789." 'backspace =8 If source <> 8 Then If InStr(Numbers, Chr(source)) = 0 Then LimitTextInput = 0 exit Function end If end If LimitTextInput = source End Function Return
Visual Basic Codes
ActiveX
Miscellaneous
Applications
Code Snippets
Common Dialogs
Special Effects
Database Stuff
Date Time
Files Drives
Forms
Graphics Games
Internet Stuff
Multimedia
Other
Strings
Windows