C# Processing Enter Key on Custom Container
Posted
by tycobb
on Stack Overflow
See other posts from Stack Overflow
or by tycobb
Published on 2010-06-05T11:29:54Z
Indexed on
2010/06/05
11:32 UTC
Read the original article
Hit count: 280
I am currently building a custom container control. Everything was going along smoothly until I hit a snag during testing.
I noticed that the Enter key is not getting processed to the control that has focus inside the container. Everything else works as expected though. I am able to click the button with either the mouse or space bar, but enter does not want to get processed.
After doing endless searches on container controls and processing the enter key I have come up with no solution. I tried returning Enter as true in IsInputKey(Keys keyData) and that didn't work. Neither did setting KeyPreview on the form. I have tried it with my custom button and .NET's standard button. Like I mentioned earlier, spacebar will trigger the desired effect.
Please tell me what I am missing. There has to be an easy / stupid simple way to get Enter to process over to the active child control.
© Stack Overflow or respective owner