WebBrowser Steals Focus

Whenever the Navigate(URL) method is called the WebBrowser control steals the focus from the application once the URL is loaded. Is there anyway to prevent this I have an application that functions similar to outlook in that you click on results and they open in the preview. The preview window is a WebBrowser so I want the focus to remain on the results when I click one so that I can scroll through them with the arrow keys. However the WebBrowser steals the focus so that the arrow keys only scroll the web page.

Thanks,

Dan



Answer this question

WebBrowser Steals Focus

  • Fatih Boy

    I have tried that, but once the browser gets the focus you cannot programmatically set it anywhere else. The only way to get the focus to move is by tabbing or mouse-click.
  • Per Dunberg

    One possibility -- handle the WebBrowser's Navigated event and set focus back to where you want it to be.
  • Ran Mouri

    Actually, the focus is probably being moved to the WebBrowser after the Navigated event fires, so focus is being moved off the WebBrowser by you, then back by the WebBrowser. Try handling the GotFocus event instead.

  • WebBrowser Steals Focus