Help Capturing F5 KeyPress

Nov 4 2010 2:32 PM

Ok very simple I thought, but I can't get it to work. I have a form with a webbrowser control, that I want to capture the F5 keyPress and block it. But for the life of me I cannot do it, the WebBrowser control always gets the event.

I tried this code, but it does not work. Any help is appreciated.


        private void frmMain_KeyDown(object sender, KeyEventArgs e)
{
// Capture F5 KeyPress
if (e.KeyCode == Keys.F5)
{
MessageBox.Show("F5 Key Pressed!");
e.Handled = true;

}
}

Answers (4)