Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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.
-Ben LaBore
Posted
Hmmm... e.Handled doesn't seem to effect the keystroke in the KeyUp or KeyDown events. Do I need to set some other properties?
-Ben LaBore
  • Leaders
Posted
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.

  • *Experts*
Posted
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).

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...