dcsimg
 

Submitted by: Oracy(oracy.jr@gmail.com)

Thursday Oct 27th 2016 by Oracy

Language: Visual Basic Classic (6 and earlier)||Expertise: Advanced

Filtering user input is extremely mundane. Who never captured user's keystrokes in a TextBox in order to avoid some forbidden input, such as numbers or letters?

If you went down this rabbit hole, here are some things to keep in mind:

  1. User can hit navigational keys like Left Arrow, Right Arrow, Home, End, or Tab. They are perfectly valid keys in a TextBox.
  2. Remember to allow selection combinations keys like Shift + Home, Shift + End, Shift + Left Arrow, and Shift + Right Arrow as well.
  3. Del and Back Space should never be filtered out.
  4. You should probably allow Ctrl + C and Ctrl + X combinations, but maybe restrict Ctrl + V.
  5. If you restricted Ctrl + V, you should think what to do when user right-clicks the TextBox and select Paste in the contextual menu that appears.
  6. If your TextBox has an associated Help context ID, you should allow the F1 key.
Home
Mobile Site | Full Site