Enter is not character; and there is no such characters. And this is always a bad idea to convert characters to integer; remember, this is Unicode. And keys are generally not character, they are handled before characters are created. To handle key hits, you need to handle events like
KeyDown
or
KeyUp
. For example:
this.KeyDown += (sender, eventArgs) => {
if (eventArgs.KeyCode == Keys.Enter)
DoSomething();
}
Another bad idea is using MDI, ever. Why torturing yourself and scaring off your users?
Do yourself a great favor: do not use MDI at all. You can do much easier to implement design without it, with much better quality. MDI is highly discouraged even by Microsoft, in fact, Microsoft dropped it out of WPF and will hardly support it. More importantly, you will scare off all your users if you use MDI. Just don't. Please see:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[
^],
How to Create MDI Parent Window in WPF?[
^].
I can explain what to do instead. Please see my past answers:
How to Create MDI Parent Window in WPF? [
Solution 2],
Question on using MDI windows in WPF[
^],
MDIContainer giving error[
^],
How to set child forms maximized, last childform minimized[
^].
—SA