4
Answers

Help Capturing F5 KeyPress

Donald Neisler

Donald Neisler

14y
12.6k
1

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)
Next Recommended Forum