MouseDown event on a Label ?

  • Thread starter Thread starter rsmith
  • Start date Start date
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
 
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
 
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
 
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
 
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'.
 
Back
Top