Advancing the Webbrowser Control

You need to have "HTML Object Library" in the References window, and a webbrowser control (Microsoft Internet Controls). Once you've inserted this code into your project, you'll notice a new object in the Code window called mdocDocument. It has lots of events, such as: Click, Double Click, Mouse Move, KeyUp, KeyDown and lots more...

Place the following code in the General Declarations section

Private mhtmDoc3 As IHTMLDocument3
Private WithEvents mdocDocument As HTMLDocument

' When navigating to a new page, update the Object we're monitoring
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
  Set mhtmDoc3 = WebBrowser1.Document
  Set mdocDocument = mhtmDoc3
End Sub

You might also like...


Kym Manson Till the Roof comes off Till the Lights go out Till my Legs give out Can't shut my mouth I will not fall, my Wisdoms all.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry