Control arrays are simple in Vb
You simply add a control to your form, right click on it choose copy and then paste onto the form. VB will ask if you want to create a control array and if you say yes you have a control array with two controls in it Text1(0) and Text1(1) for example You can keep pasting additional text boxes and the index value will increase.
When using a control array all controls in the array share the same sub routines for event handlers and pass an Index to the event in order to identify which one triggered the event.
An event from a normal text box would look like
An event from a text box array would look likeCode:Private Sub Text1_Change() End Sub
In the case of an array you would typically add a Select Case statement to test the index value or an If statement or maybe not depending on what you need it to do.Code:Private Sub Text1_Change(Index As Integer) End Sub




Reply With Quote