preventing controls from handling key events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hallo,
i would like to prevent TextBox and ComboBox from handling some keyevents. I
have installed SP3. For example TextBox should not handle Keys.Up/Down,
ComboBox should not handle alphabetic keys ans so on... (i would like make
own handlers in derived controls).
I tryed to register KeyDown handler witch sets KeyEventArgs.Handled to true,
override OnKeyDown,Up,Press without calling base.OnKey... but without any
success. Is there any way to do so?
 
You can suppress alphanumeric key by using KeyDown handler together with
KeyPress handler but this method doesn't work for Up/Down keys in the
multiline textbox. To avoid this problem use OpenNETCF IMessageFilter to
handle WM_KEYDOWN for your control. Here's how to accomplish it:

http://www.sergeybogdanov.com/Samples/TextBoxKeyDownFilter.zip

The same technique can be used to ComboBox control.

Hope this help,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
How do you get the control to get the events in the first place?
Under smartphone, they are not getting to the control?

Miron
 
Back
Top