Pritorian
Pritorian

Reputation: 450

How to provide KeyPress event to WebBrowser control?

i really need to catch "ESC" key press while focus is on WebBrowser control. I tried something like this:

(webControl as Control).KeyPress += new KeyPressEventHandler(MyKeyPressEventHandler); 

But it doesnt work. The method is not called. I tried some methods, described here, but dont get any result ( Help, please.

Upvotes: 2

Views: 3177

Answers (1)

Vincent Lidou
Vincent Lidou

Reputation: 201

this.webBrowser.Document.Body.KeyUp += new HtmlElementEventHandler(Body_KeyUp);

Upvotes: 2

Related Questions