Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.visual.basic    |    MS Visual Basic discussions, NOT dot-net    |    10,840 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 9,929 of 10,840    |
|    Rick Rothstein [MVP - Visual Basic] to All    |
|    Re: viusal basic input validation intege    |
|    28 Feb 06 18:10:59    |
      XPost: comp.programming       From: rickNOSPAMnews@NOSPAMcomcast.net              > What you can do on a text box control that is being used for only       > numbers is use the Keypress Event and check the key being pressed. If       > it's a numeric key 0-9, you accept the keypress. If the key is not a       > numeric key 0-9, the you cancel or don't accept the keypress. I recall       > ASCII code 0 or something like that cancels key-code from a key press so       > that it's not accepted.       >       > You just write a Keypress event routine that accepts numeric keys or       > possibly a control key like the ESC-Key, Backspace-Key or ( Tab-key set       > focus to the next control), take the appropriate actions on the       > control-keys, cancel any key that's not 0-9 and only accept the 0-9 keys.              You can't take appropriate action on "true" control keys in the KeyPress       event; that requires the KeyUp or KeyDown event. And if you don't handle all       of the keystrokes that allow a user to Paste data (and the Mouse events that       allow it too), then your user will be able to Paste non-digits into the       TextBox. And, after all of that, I think you will still have missed one or       two places where the user can initiate a Paste operation.              Rick              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca