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.
e.Handled doesnt do anything in a textboxs 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.
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).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.