954,517 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Vb.net webbrowser help?

i want to show a msgbox when i click on the webbrowser control on my form.. how do i do it? why isnt there a mouseclick event in the webbrowser method listbox?

tableray
Newbie Poster
10 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 
why isnt there a mouseclick event in the webbrowser method listbox?

Because the mouse click is sent to the web page shown in the control. Just like you normally click the web pages in your browser. The explanation above is not totally correct, but I think it's good enough ;)

I don't know why would you like to trap the mouse click, but you could try to use GotFocus event

Private Sub WebBrowser1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles WebBrowser1.GotFocus
  '
  MessageBox.Show("Click", "Click", MessageBoxButtons.OK, MessageBoxIcon.Information)

End Sub



It does have its limitations compared to "normal" Click event.

Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
 

yup i tried using that initially but it doesnt work.. the msgbox showed even before the form appeared.. and the msgbox keeps popping up..

tableray
Newbie Poster
10 posts since Jan 2009
Reputation Points: 10
Solved Threads: 0
 

There's GeckoFX which I haven't used myself. But I guess it will handle mouse clicks like WebBrowser does.

You may have to do it a bit harder way with Windows API Reference or by using a global mouse hook .

Teme64
Veteran Poster
1,031 posts since Aug 2008
Reputation Points: 218
Solved Threads: 203
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You