R
Rob
I need a way to determine the name of the control that
called an event. I have tested many different code
variations but none seem to work. The one that makes the
most sense to me is below, but it does not work either.
The Name property is not valid here but I would expect it
to be. What am I doing wrong.
Private Sub btn1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btn1.Click
Dim btnName As String
btnName = CType(sender, Button).Name
End Sub
-- or --
Private Sub btn1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btn1.Click
Dim btn As Button
Dim btnName As String
btn = CType(sender, Button)
btnName = btn.Name
End Sub
Thanks for any help you can provide me.
Rob
called an event. I have tested many different code
variations but none seem to work. The one that makes the
most sense to me is below, but it does not work either.
The Name property is not valid here but I would expect it
to be. What am I doing wrong.
Private Sub btn1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btn1.Click
Dim btnName As String
btnName = CType(sender, Button).Name
End Sub
-- or --
Private Sub btn1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btn1.Click
Dim btn As Button
Dim btnName As String
btn = CType(sender, Button)
btnName = btn.Name
End Sub
Thanks for any help you can provide me.
Rob