[RESOLVED] How to identify the control that was clicked?
Could anyone please tell me how my program could identify the control that is clicked? In other words, lets say I have 20 controls on the form(no arrays, all different control types). And in the click event for any given control, I want to be able to call a function and pass to that function the name of the control that was clicked. How would I code that? Thanks in advance. Ron E.
Re: How to identify the control that was clicked?
Re: How to identify the control that was clicked?
Welcome to the forums.
Any clickable control has a click event, pass itself to the function
Code:
Private Sub Image1_Click()
ProcessClickedControl Image1
End Sub
Private Sub ProcessClickedControl(theControl As Control)
MsgBox theControl.Name & " was just clicked"
End Sub
Re: How to identify the control that was clicked?
Thanks, Keith. I just could not believe it was that simple. Ron