[SIZE=2]alTextBox.Add("textbox1") [/SIZE][SIZE=2][COLOR=#008000]'Textboxes names. Must be lower case. You can add as many as you like.[/COLOR][/SIZE]
[SIZE=2]alTextBox.Add("textbox2")[/SIZE]
[SIZE=2]alTextBox.Add("textbox3")[/SIZE]
[SIZE=2]alTextBox.Add("textbox4")[/SIZE]
[SIZE=2][COLOR=#0000ff]for [/COLOR][/SIZE][SIZE=2]i = 1 [/SIZE][SIZE=2][COLOR=#0000ff]to [/COLOR][/SIZE][SIZE=2]11 [/SIZE][SIZE=2][COLOR=#008000]'Adds the click event to all regular number buttons.[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]AddEvent[/COLOR][/SIZE][SIZE=2]("Button" & i, Click, "Numbers_Click")[/SIZE]
[SIZE=2][COLOR=#0000ff]next[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for [/COLOR][/SIZE][SIZE=2][COLOR=#000000]i = 0 [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]to [/COLOR][/SIZE][SIZE=2][COLOR=#000000]alTextBox.Count -1 [/COLOR][/SIZE][SIZE=2][COLOR=#008000]'Adds the gotfocus event to all textboxes.[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]AddEvent[/COLOR][/SIZE][SIZE=2][COLOR=black](alTextBox.Item(i),GotFocus, "TextBoxes_GotFocus")[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]next[/COLOR][/SIZE]
[SIZE=2][COLOR=black]focused = alTextBox.Item(0)[/COLOR][/SIZE]
[COLOR=black][SIZE=2]Control[/SIZE][SIZE=2](focused).Focus[/SIZE][/COLOR]
[/COLOR][/SIZE]
In this example the numpad is being used to edit four textboxes.
First we add the textboxes names to an arraylist (alTextBox).
The second For loop connects all the textboxes GotFocus event with Sub TextBoxes_GotFocus. The other option is to manually create one sub for each control (with duplicated code).
At the end of this code we use the global variable 'focused' with the Control keyword to set the focus to the first textbox.
I recommend you to go over the help of Control and AddEvent which both are very useful for working with a large number of similar controls.