What you're talking about is handling the 55 different events with one method. The answer is the
Handles
clause of the event handler method.
When you double-click a control in the designer, it will generate a method to handle the default event, e.g. the
TextChanged
event of a
TextBox
. If you double-click a control named
TextBox1
, you'll see this code generated:
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
End Sub
Note the
Handles
clause there. That specifies which events are handled by that method. You can manually edit that Handles clause if you want, e.g.
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged
End Sub
but I wouldn't recommend that for 55 controls. The way you should normally do it is first select all the controls in the designer, then open the
Properties window and click the
Events button. That will list all the events for the selected item(s) and you can then double-click an event to generate an event handler. If you have selected multiple controls, they will all be included in the
Handles
clause. You can also use the drop-down for any event to select an existing event handler and have that event for that control added to the
Handles
clause. I would suggest that, if you use a single method to handle multiple events, you change the name to reflect that, e.g.
TextBoxes_TextChanged
instead of
TextBox1_TextChanged
.