Hi Vernon Marsden,
First, the WebBrowser control does not have a mouse up event. Because the mouse event occurs in the displayed document, not the control itself.
So you need to capture mouse events associated with the document object in the webBrowser control.
Here is my test code you can refer to.
Private Sub WebBrowser1_DocumentCompleted(sender As Object, e As WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
AddHandler WebBrowser1.Document.MouseUp, AddressOf eventSub
End Sub
Sub eventSub(ByVal sender As Object, ByVal e As System.Windows.Forms.HtmlElementEventArgs)
Dim event_html As New HtmlElementEventHandler(AddressOf webMouseUp)
event_html.Invoke(sender, e)
End Sub
Sub webMouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.HtmlElementEventArgs)
If e.MouseButtonsPressed = Windows.Forms.MouseButtons.Left Then
MsgBox("left clicked!")
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
WebBrowser1.DocumentText =
"<html><body>Please enter your name:<br/>" &
"<input type='text' name='userName'/><br/>" &
"<a href='http://www.microsoft.com'>continue</a>" &
"</body></html>"
End Sub
The result:
>>How do I "Add reference to Microsoft HTML Object Library" ?
You can add it by following the steps below:
Right click your project ->Add-> Reference->Search for Microsoft HTML and choose Microsoft.mshtml->OK
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.