Hi,
I'm trying to detect a right click on any one of at least 150 labels, the labels are application generated.
The generating code includes an AddHandler:
Running the code with a breakpoint set at the first instruction of the LabClik subroutine:
I can see the detail of e. which includes:
+ e {X = 22 Y = 24 Button = Left {1048576}} System.EventArgs {System.Windows.Forms.MouseEventArgs}
However, when I include the instruction:
Intellisense complains about "e.Button", saying that it's not a member of EventArgs, despite the fact that I can see "e.Button", and it's value in the Watch1 window.
In the past I've written a Subroutine using...
... which allowed me to read the "e.Button", so I tried:
(With and without the two ByVal's)
This did allow "e.Button", but... Now... Intellisense complains:
Option Strict On does not allow narrowing in implicit type conversions between method 'Private Sub LabClik(sender As Object, e As MouseEventArgs)' and delegate 'Delegate Sub EventHandler(sender As Object, e As EventArgs)'.
Changing 'Private Sub' to 'Public Sub' only changed the complaint from 'Private Sub' to 'Public Sub'.
As I'm reluctant to switch Option Strict to Off I can't find where to go from here.
Poppa.
I'm trying to detect a right click on any one of at least 150 labels, the labels are application generated.
The generating code includes an AddHandler:
Code:
AddHandler lbl.Click, AddressOf LabClik
Code:
Private Sub LabClik(sender As Object, e As System.EventArgs)
If boom Then Exit Sub
Quote:
+ e {X = 22 Y = 24 Button = Left {1048576}} System.EventArgs {System.Windows.Forms.MouseEventArgs}
Code:
If e.Button = Windows.Forms.MouseButtons.Right Then
In the past I've written a Subroutine using...
Code:
Private Sub Pict_Click(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
Code:
Private Sub LabClik(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)
This did allow "e.Button", but... Now... Intellisense complains:
Quote:
Option Strict On does not allow narrowing in implicit type conversions between method 'Private Sub LabClik(sender As Object, e As MouseEventArgs)' and delegate 'Delegate Sub EventHandler(sender As Object, e As EventArgs)'.
As I'm reluctant to switch Option Strict to Off I can't find where to go from here.
Poppa.