Form Keypreview is not working when the focus is on combobox

R

Ramana

Hi,
We are handling some keys in the form to perform some form based actions.
for example Ctlr+s will save the data on the form which is equivalent to
pressing the save button. But when the focus is on a combobox, then we are
not able to capture the keys (i.e form's keypdown/up events are not being
fired). IS this a bug or known issue?
Is there any solution to fix this problem?

Advance thanks
Ramana
 
H

Herfried K. Wagner [MVP]

* "Ramana said:
We are handling some keys in the form to perform some form based actions.
for example Ctlr+s will save the data on the form which is equivalent to
pressing the save button. But when the focus is on a combobox, then we are
not able to capture the keys (i.e form's keypdown/up events are not being
fired). IS this a bug or known issue?

Yes, this is a known bug.
Is there any solution to fix this problem?

Add a menu item and assign the shortcut, then hide the menu and add code
to the item's 'Click' event (untested).
 
S

Saurabh

Yes its a bug,
I think its something to do with the edit control associated with the
combobox. If you see the classes, the edit control is old EDIT type whereas
if you add an edit control in dotnet form it is of type
WindowsForms.blahblah..... If your application does not demand having
editable combo, change the style to dropdown list and it will work....
haven't tried it but that style change will remove the EDIT from the form ;)

--Saurabh
 

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