Trying to program code to Exit application upon ESC in C#?
<p>I am learning more C# programming and have developed an application using Ogre. However the only method I have of exiting the application when running it is, ALT+F4. </p>

<p>I have put in the code a method to Exit with keyPress ESC. However, Visual C# Express is throwing error, and not letting me use ProcessCmdKey. :\</p>

<p>Help?</p>

<pre><code>using System;
using System.Windows.Forms;

    protected override bool ProcessCmdKey(ref LogMessageLevel msg, Keys keyData)
    {
        if (keyData == Keys.Escape) this.Close();
        return base.ProcessCmdKey(ref msg, keyData);
    }
</code></pre>
