How to prevent webbrowser ctrl from maintaining focus after navigate?
Posted on 2002-04-10
I have a simple project consisting of a textbox, a command button, a webbrowser and a single form on which those three controls are placed. What happens is the user enters a web address in the textbox and then clicks the command button to navigate. What I want to happen is for the textbox to regain the focus after the webbrowser finishes navigating.
The code behind the command button looks like this:
-- Begin --
webBrowser.Navigate txtSearchStr 'txtSearchStr = textbox
'Set focus back to the textbox
-- End --
This seems to work but if and only if the web page to which the webbrowser navigated does not have a textbox of it's own. If it does, then the webpage tends to take focus.
I've also tried setting the textbox back to focus in the webbrowser's DocumentComplete and DownloadComplete events but the textbox still doesn't regain the focus.
I would like to allow the webbrowser to have a tabstop if possible.
Looking forward to your replies.