Hi. I have the keypreview property of a form set to True and I am handling certain keys at the form level. This works fine for all controls except when a combobox has the focus. Has anyone seen this before and is there a remedy?
Yes something like that. I have an application using mdi forms. I have certain 'hotkeys' that do things like close the current form, switch forms etc. I want the mdi parent form to catch these and deal with them without going to the child form at all. So, I don't want to have to code for every combobox in the app cause there are quite a few and it would be easy to miss one or two.
If you don't want the combobox to maintain focus after it is used, you can add a line of code to give the focus to another control after the combobox processing is done. There may be other solutions, but This is all I could think of right now. If I find more info, I will get back to you.
Sorted. I was using a derived combobox so I stuck in an overridden OnKeyDown method. It calls a routine on the parent form which accepts the KeyEventArgs from the control. So if it handles the keydown event the control does nothing and if it doesn't then the combobox does it's normal thing.
Thanks for your help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.