What is the use of e.Handled in the KeyDown event
-
As far as I have been able to tell setting e.Handled to true does absolutely nothing. I'm wondering why it's even available for the KeyDown event. Could someone please tell me? I have looked at the documentation for the textbox control and the KeyDown checks the value and sets some class variable, then the KeyPress checks that variable and sets e.Handled based on the value of the variable. Thank you.
- Kalvin
-
As far as I have been able to tell setting e.Handled to true does absolutely nothing. I'm wondering why it's even available for the KeyDown event. Could someone please tell me? I have looked at the documentation for the textbox control and the KeyDown checks the value and sets some class variable, then the KeyPress checks that variable and sets e.Handled based on the value of the variable. Thank you.
- Kalvin
If you derive a class from TextBox, handle KeyDown event, and set Handled to true, that control will not pass the key press events to the underlying Win32 text box control, but it will still display the characters that the user typed. Set it to false so that the underlying Win32 text box control can do the default handling.