My code is:
using System.Windows.Forms
class Class1
{
protected override bool ProcessCmdKey (ref Message msg, Keys keyData)
{
if (keyData == Keys.Up)
{
Console.WriteLine("You pressed the Up arrow key");
return true;
}
...
return true;
}
}
But all I get is the error:
(namespace). (class) .ProcessCmdKey (ref System.Windows.Forms.Message, System.Windows.Forms.Keys): no suitable method to override was found.
And if I turn off
return true;
for
return base.ProcessCmdKey (ref msg, keyData);
I get an error message:
'object' does not contain a definition for ProcessCmdKey.
In fact, my ProcessCmdKey text doesn't even turn green in color, but it stays black when I know that it should be green.
Is this something with the version of the .NET Framework that I am using? Anyway, I use Microsoft Visual Studio 2013 to compile and run my codes.
Or is it somehow related to the security level of my class? I work with a public level class
, . , , , . .