Retaining/discarding keystrokes

R

Randy Dod

When the user is typing in a textbox, is there a way to
discard certain keystrokes in the keydown event? Such as,
if they type an "e" simply not display it. I found a
clunky way to do it by switching to a checkbox, and then
in the keyup event of the checkbox, set the focus back to
the textbox. Is there an easier way?

Conversely, I've noticed that if my code takes a long time
in the keydown event, it will lose the keystroke that
way. Of course I need to make my code faster, but short
of that, how do I make sure it doesn't get lost?
 
J

Jezebel

Simply zeroing the Keycode does it. Bear in mind that the codes are ANSI
keyboard codes, not character values. To remove 'e' --

If Keycode = 69 then
Keycode = 0
end if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top