MouseDown event on a Label ?

R

rsmith

How can I capture the MouseDown event on a Label ?
I entered thr following code and got a " cannot handle
Event 'MouseDown' because they do not have the same
signature."
Private Sub Label1_MouseDown _

(ByVal sender As System.Object, ByVal e As System.EventArgs) _

Handles Label1.MouseDown

bSelect = True

End Sub
 
A

Armin Zingler

rsmith said:
How can I capture the MouseDown event on a Label ?
I entered thr following code and got a " cannot handle
Event 'MouseDown' because they do not have the same
signature."
Private Sub Label1_MouseDown _

(ByVal sender As System.Object, ByVal e As System.EventArgs) _

Handles Label1.MouseDown

bSelect = True

End Sub

ByVal e As System.Windows.Forms.MouseEventArgs
 
K

Ken Tucker [MVP]

Hi,

The procedure has the wrong arugments for the mousedown event. It should accept mouseventargs not eventargs.

Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown

bSelect = True

End Sub

How can I capture the MouseDown event on a Label ?
I entered thr following code and got a " cannot handle
Event 'MouseDown' because they do not have the same
signature."
Private Sub Label1_MouseDown _

(ByVal sender As System.Object, ByVal e As System.EventArgs) _

Handles Label1.MouseDown

bSelect = True

End Sub
 
C

Cor

Hi Rsmith,

You had probably first a click event and changed the handles just in mousedown :).
That cannot because the "event argument" is totaly different.

This is the one from the mousedown.
Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown

Cor
 
H

Herfried K. Wagner [MVP]

rsmith said:
How can I capture the MouseDown event on a Label ?

Yes, this can be done. Please do not post in HTML format in future
(plain-text is the preferred format).
I entered thr following code and got a " cannot handle

Event 'MouseDown' because they do not have the same

signature."

Private Sub Label1_MouseDown _

    (ByVal sender As System.Object, ByVal e As System.EventArgs) _

Replace the 'System.EventArgs' with 'System.Windows.Forms.MouseEventArgs'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top