hi all...
Is it possible to find out which control a user rightclicked on and show the name of the control in a messagebox
For example I have three buttons on a form and a contextmenu that is used in common with all the buttons. When a user rightclicks on a button the context menu is shown. Kind of like the "Whats This" menu in MS Apps. So instead of writing a rightclick event for all of the controls on the form, I thought that if I could find the name of the control that the user rightclicked on to open to context menu, I could show the appropriate response.
Is there a way to find if a coordinate of the mouse click falls within a control or is there an easier way for this
Any help is appreciated. Thanks in advance.

Which Control did I RightClick on?
liujun
There are several ways to do this... if you want a common event handler
Private Sub cbGo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbGo.Click,cbStart.Click,cbStop.Clickdim b as button = sender
Select Case button.Name
Case "cbGo"
...process go button
Case "cbStart"
.... Process Start button
Case "cbStop"
Process Stop button
End SubArchade
Thanks for the replies... I have tried this with the common event handler, but for that I need to actually add the name of every control after the Handles argument. Since I will probably be adding and removing controls from the form, I was wondering if there was a way to find the control that was right-clicked on (by using the form1 mouseclick event along with the coordinates clicked on) so kind of like:
Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
If e.Button = Windows.Forms.MouseButtons.Right Then
If e.Location = ... Then[which control did I click on by location]...
End If End If End Sub
If I could be pointed in the right direction about this I would appreciate it. Is there a way to know which control I clicked on so I can later use a "select case" statement and show the appropriate message according to the control name.
Thanks in advance...
Lelic
Igor_G