Home All Groups Group Topic Archive Search About

How to trap F5 in Windows Forms?

Author
25 Nov 2004 7:41 AM
Ryu
Hi All,

I have created a simple form that displays a simple message. But the message
cant seem to be displayed? Any reason why? Below is my code.

private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs
e)

{

    if(e.KeyCode == Keys.F5)

    {

        MessageBox.Show("It is done");

    }

}

Author
25 Nov 2004 8:33 AM
Pieter Jansen van Vuuren
Set the KeyPreview of your form to true.

"Ryu" <blizzardstorm8***@yahoo.com> wrote in message
news:#udhkIs0EHA.1940@TK2MSFTNGP15.phx.gbl...
> Hi All,
>
> I have created a simple form that displays a simple message. But the
message
> cant seem to be displayed? Any reason why? Below is my code.
>
> private void Form1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs
Show quote
> e)
>
> {
>
>     if(e.KeyCode == Keys.F5)
>
>     {
>
>         MessageBox.Show("It is done");
>
>     }
>
> }
>
>

AddThis Social Bookmark Button