tags:

views:

10

answers:

1

My winform window was working fine then i added a combobox to it. Now my code which uses theform_KeyDown does not work. From my understanding when it gets focus it gives it to my combobox thus my window keydown event never happens? I had pictureboxes and no matter where i clicked i was able to use the keys nicely.

How do i allow keys to work again painlessly? it seems like i need to modify all the forms setfocus or add key events for this to work again. What is the easiest way?

I asked a focus question before so the answer may help give ideas but probably not

+1  A: 

Once a form contains a child control that can receive the focus (in other words, not a picture box) then the form can no longer receive the focus. And thus won't get keyboard messages anymore, they'll go to the control with the focus. A quick fix is to set the form's KeyPreview property to True.

Hans Passant