Key event in VS2003

Microsoft Visual Studio .NET

Thomas
I used this code and compiled it in VS2002 and there it works fine.

#region Key events
protected override void OnKeyDown(KeyEventArgs kea)
{
switch (kea.KeyData)
{
case Keys.Enter:
...
..
break;
case Keys.Escape:
this.Close();
break;
}
}
#endregion

The class is deriving from System.Windows.Forms.Form

I then compiled it in VS2003 and it woudn't enter the method when I make
a key event like Esc or any other.

Anyone knows why?


Thanks
Thomas
                                            
Thomas
The default value of KeyPreview is sett to false in .NET Framework used by
VS2003. It is true by default in the previous version.

this.KeyPreview = true;


Thats it!