タブインデックスすに、テキストBOXを多数ロードしたいです。
タブごとに、テキストボックスのコントロール名が違います。
タブが5個あると、下記のコードだと長くなりますが、
まとめる事はできますか?
SSTab1.Tab = 3
intIndex = 0
For k = 0 To 9
For i = 0 To 3
If intIndex <> 0 Then
Call Load(txtWrong4(intIndex))
End If
With txtWrong4(intIndex)
.Visible = True
If i = 0 Then
.Left = txtWrong4(i).Left
Else
.Left = txtWrong4(i - 1).Left + txtWrong4(i - 1).Width
End If
.Top = txtWrong4(0).Top + txtWrong4(0).Height * k
End With
intIndex = intIndex + 1
Next i
Next k
SSTab1.Tab = 4
intIndex = 0
For k = 0 To 9
For i = 0 To 3
If intIndex <> 0 Then
Call Load(txtWrong5(intIndex))
End If
With txtWrong5(intIndex)
.Visible = True
If i = 0 Then
.Left = txtWrong5(i).Left
Else
.Left = txtWrong5(i - 1).Left + txtWrong5(i - 1).Width
End If
.Top = txtWrong5(0).Top + txtWrong5(0).Height * k
End With
intIndex = intIndex + 1
Next i
Next k
違うところだけ変数に置き換えればいいのでは?
編集 削除