Option Explicit
' At least two Textboxes arranged in a Control Array
' Add One ComboBox, One Timer and One Shape
' Use default names for all controls
Dim blnBackgroundMode As Boolean
Dim lngTextBoxIndex As Long
Dim a As Long
Private Sub Combo1_Click()
lngTextBoxIndex = Combo1.Text
With Text1
For a = .LBound To .UBound
With .Item(a)
.BackColor = vbWhite
.ForeColor = vbBlack
.FontBold = False
blnBackgroundMode = True
End With
Next a
End With
End Sub
Private Sub Form_Load()
With Text1
For a = .LBound To .UBound
With .Item(a)
.Text = "Level " & a + 1
.Alignment = 2
.Appearance = 0
.FontBold = False
Combo1.AddItem a
End With
Next a
Combo1.ListIndex = 0
End With
With Timer1
.Interval = 250
.Enabled = True
End With
End Sub
Private Sub Timer1_Timer()
With Text1.Item(lngTextBoxIndex)
Shape1.Move .Left - 50, .Top - 50, .Width + 100, .Height + 100
Shape1.Visible = True
If blnBackgroundMode Then
.BackColor = vbWhite
.ForeColor = vbBlack
Shape1.BorderColor = vbRed
blnBackgroundMode = False
Else
.BackColor = vbRed
.ForeColor = vbWhite
Shape1.BorderColor = vbBlack
blnBackgroundMode = True
End If
.FontBold = Not (.FontBold)
End With
End Sub