blabore Posted July 11, 2003 Posted July 11, 2003 Is there any way to cancel a keystroke in a textbox in the KeyUp/KeyDown/KeyPress events? In VB 6 you could set KeyAscii to 0, which would prevent the key from showing up in the textbox. Any help would be appreciated. Quote -Ben LaBore
*Experts* Volte Posted July 11, 2003 *Experts* Posted July 11, 2003 In the KeyPress event:e.Handled = True Quote
blabore Posted July 11, 2003 Author Posted July 11, 2003 VolteFace, Thanks, that worked. There's no way to cancel the keystroke from the KeyUp or KeyDown events? Quote -Ben LaBore
*Experts* Volte Posted July 11, 2003 *Experts* Posted July 11, 2003 Er yes... use the same way I just said. It works in all three. Quote
blabore Posted July 11, 2003 Author Posted July 11, 2003 Hmmm... e.Handled doesn't seem to effect the keystroke in the KeyUp or KeyDown events. Do I need to set some other properties? Quote -Ben LaBore
Leaders dynamic_sysop Posted July 11, 2003 Leaders Posted July 11, 2003 e.Handled doesnt do anything in a textbox's keyup / keydown ( well atleast not on quite a lot of key presses , you can handle / divert stuff though on them events , like moving focus or triggering something else. Quote
*Experts* Volte Posted July 11, 2003 *Experts* Posted July 11, 2003 Well, KeyPress is the sub that does the "typing" of characters in a TextBox or whatever; KeyUp and KeyDown fire when you press a key (no matter what happens to the text in the textbox). You need to use KeyPress to handle the typing of text and KeyUp/Down to handle the pressing of keys in general (be it F12 or Control-H). Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.