n.Mehta n.Mehta - 1 year ago 87
Vb.net Question

How to disable clicking Webbrowser, but still able to scroll WebBroswer

I have a WebBrowser in my VB.net form. I want to disable from users clicking links in the Webbrowser, but still able to scroll the Webbrowser.
I found this code but it locks up the whole WebBroswers so I can't click links or scroll, but I need to be able to scroll.

DirectCast(WebBrowser1, Control).Enabled = False

Answer Source

Just set the following property:

WebBrowser1.AllowNavigation = False

A hacky work-around to change the address from code would be to turn AllowNavigation on again, but it requires a BeginInvoke to allow the navigation to take place before turning it off again:

WebBrowser1.AllowNavigation = True
WebBrowser1.Navigate("new web address...")
Me.BeginInvoke(New Action(Sub() WebBrowser1.AllowNavigation = False))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download