Is it possible that when a user clicks, the fact that she may have clicked
on two overlappping labels, for instance, be responded to ?

In other words could the Sub for a click on Label1 check that Label2 has actually
been clicked simultaneously ?


6 Years
Discussion Span
Last Post by Pgmer

i have not experimented with that, but with 99% confidence i would say that a click is captured by a single control only.

is this click-all-overlapping-controls something you want to happen or something you don't want to happen?



ya izyrider is correct. when click on one control u want to fire one more control that you can do..


Yes, I DO want it to happen.

Given there are so many controls on my form I thought having them effectively
in a grid would be easier to use than checking for x,y coordinates and so on.

But thanks for the objective answer anyway.


If both the control are same which u want to fire then you can do something like this.

Private Sub Label1_Click(ByVal sender As Object, ByVal e As System.EventArgs)Handles Label1.Click, Label2.Click, Label3.Click
' Your code what u want to do
End Sub

Edited by Pgmer: n/a


The problem with : Handles Label1.Click, Label2.Click, Label3.Click
is that it assumes that Label2 CAN be clicked at all which may not be true at all
( if, for instance, Label2 is entirely inside Label1 ).

The good news for me is that I have solved my problem otherwise.
I have since discovered the wonderful world of Tags,
meaning I only need 2 lines of code such as :

Dim btnClicked As Label = DirectCast(sender, Label)
Dim XY As Integer = Integer.Parse(btnClicked.Tag)

So just make sure Label97 is tagged as 97 and so end of.

Thanks everybody.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.