שתף באמצעות


How to block Visual Basic WebBrowser Error Messages

Question

Saturday, October 22, 2011 5:01 PM


I am creating a simple VB.NET WebBrowser to automate and simplify navigation of a web site. However on certain pages i get the following popup message. This is telling me about an error which is on the Web Site itself and thus out of my control.

Is it possible to block these popups from my application?

The application is for personal use, so auto-clicking yes would be an acceptable option.

Thanks in advance

All replies (3)

Saturday, October 22, 2011 5:11 PM ✅Answered | 1 vote

Hi Michael,

The WebBrowser control uses the IE settings, so if you disable script debugging and script error notifications in IE it should carry over to the WebBrowswer control and therefore your application.  If you want to do it in only the WebBrowser control itself, you can do:

WebBrowser.ScriptErrorsSuppressed = True

Tom Overton


Saturday, October 22, 2011 5:17 PM

Tom,

You sir, are a gentleman

Thankyou very much, not only did it work a treat but it is just one line of code :)

Thanks again


Saturday, October 22, 2011 5:20 PM

Michael,

Yeah it's nice when it ends up being one line of code instead of "create a custom class that implements this, override that...etc"!

 

Tom Overton