I’m using webbrowser control in my winforms app (c#). And when it is doing automation things, I’m losing focus control from the window I was working with. Webbrowsers’ form doesn’t show up also, I just lose focus from the contol. I now writing this message I have to click into textbox again and again…
How to disable such behaviour in webbrowser?
I create invisible webbrowser like that:
var br = new WebBrowser();
br.Visible = false;
br.ScriptErrorsSuppressed = true;
Please advise.
I had the same problem:
The Webbrowser Control stole focus from the application once the URL is loaded.
This worked for me:
Webbrowser.Navigate()method call, set the parent control of the Webbrowser toEnabled = false.DocumentCompletedevent of the Webbrowser, reset parent control of the Webbrowser toEnabled = true.You can’t do it directly on Webbrowser because
WebBrowserBase.Enabledis not supported.Let me know if it works for you.