e.handled in KeyDown Event

R

Richard Day

Setting e.handled = true in the KeyDown event for a
textbox does not prevent the character from appearing in
the textbox.

The following MSDN article suggests setting a global
variable in the KeyDown event and then in the KeyPress
event setting e.handled = true depending on the global
variable.

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpref/html/frlrfSystemWindowsFormsKeyEventArgsClassKeyC
odeTopic.asp

This seems a very messy solution to me.

Has anyone else experienced this issue? I am assuming
this is intentional behavior and not a bug - but why?
 

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