Issue: When the web control has the focus, the form can no longer capture keystrokes through the KeyDown event, even with KeyPreview set to 'True'.
Platform: VS 2003 running on XP Pro
Web Control: AxWebBrowser1 (imported into tool box)
1. Create a single form
- Set KeyPreview to 'True'
- Add key trapping to the 'KeyDown' event
- In Form1_Load event add the following line of code:
-
AxWebBrowser1.Navigate2("www.microsoft.com")
-
2. Add one TextBox (made sure it is set to TabIndex 0 )
3. Add AxWebBrowser1 (made sure it is set to TabIndex 1 )
4. Run the app and anytime the TextBox has the focus, the KeyDown event should work properly, but as soon as the focus is changed to the web control, KeyDown will stop working.
Interesting to note that if no navigation is performed in the web control (no 'Navigate2'), KeyDown works just fine when the focus is on the web control - it seems to be an issue only after the web control has been told to go to a URL.
We use the same web control in VB6 where the KeyDown event works just fine no matter what control on the form has the focus.
Anyone know if the behavior described above is still an issue with the new Web Browser control in VS 2005
Thanks.

KeyDown not working with Web Control