You can get it from the sender
argument:
Private Sub delete1(sender As System.Object, e As System.EventArgs)
Dim curButton As Button = DirectCast(sender, Button) 'Button you clicked
End Sub
Note that the code to add the aforementioned function directly (without delegate
) is:
AddHandler MyClass.button1(counter).Click, AddressOf delete1