Make a loop in the array of text boxes; in this loop, add an event handler to every one; in the event handler, use the same method to deal with the sender, which will be a reference to a particular text box.
If this is just validation, is some cases you won't even need to know a reference to each of the text boxes is passed to the event handling method. However, usually this is needed. The only information you can use is the reference to the sender, passed as a first parameter of the event handler.
First, you can always type-case this reference to
, because, in this scenario, this is always the sender. So, you get a reference to an instance of the
. To pass additional information, you can use the property
). In your case, it would be the best to assign an index in your array to this
. In the event handler, you type-cast
and this way know the index of the array element being handled.
I almost forgot, VB.NET does not have '+=' operator for adding a handler to an invocation list of an event instance. You need to use
. This is shown in a code sample here, see the answer #0: