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?

Recommended Answers

All 3 Replies

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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.