I have an event in VB.NET to handle several button clicks at once. I need to know which button from the selection kicked off the event. Any ideas how to do this? My code is below:
Private Sub Answer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAnswer1.Click, btnAnswer2.Click, btnAnswer3.Click, btnAnswer4.Click
'output button ID that caused event
End Sub
I’ve tried sender.Id, e.Id, sender.name, e.name. None of them work
You have to cast the sender to the object type expected.
Then you can access what you need.