Imagine you have buttons and everytime you click on one,it writes a text to a textbox.
ie:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button41.Click
textbox.Text &= "1"
End Sub
And lets say you have 10 of these buttons as numbers (0-9 for example.)Instead of handling the click events of these buttons one by one (buttonxclickevent handles textbox.text = x for example);is there a more elegant way to iterate throught these buttons and events?
Since you have shown VB.NET code, i’ll answer with VB.NET. You could use one handler for all:
Enumerable.OfTypefilters and casts, so the result is anIEnumerable(Of Button).