Здравствуйте, подскажите пожалуйсто как оптемизировать код.
Вот листинг. Буду очень благодарен за приобретенный опыт!
Dim plu(10) As Integer
Dim chislo As Integer
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Randomize
chislo = 1 + Int(Rnd * 6)
Label1(1).Caption = chislo
Command2.Enabled = False
Command1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Command1.Enabled = False
plu(1) = 0
End Sub
Private Sub Timer1_Timer()
If Image1(0).Visible = True Then
Image1(0).Visible = False
Image1(1).Visible = True
GoTo g:
End If
If Image1(1).Visible = True Then
Image1(1).Visible = False
Image1(2).Visible = True
GoTo g:
End If
If Image1(2).Visible = True Then
Image1(2).Visible = False
Image1(3).Visible = True
GoTo g:
End If
If Image1(3).Visible = True Then
Image1(3).Visible = False
Image1(4).Visible = True
GoTo g:
End If
If Image1(4).Visible = True Then
Image1(4).Visible = False
Image1(5).Visible = True
GoTo g:
End If
If Image1(5).Visible = True Then
Image1(5).Visible = False
Image1(6).Visible = True
GoTo g:
End If
If Image1(6).Visible = True Then
Image1(6).Visible = False
Image1(7).Visible = True
GoTo g:
End If
If Image1(7).Visible = True Then
Image1(7).Visible = False
Image1(8).Visible = True
GoTo g:
End If
If Image1(8).Visible = True Then
Image1(8).Visible = False
Image1(9).Visible = True
GoTo g:
End If
If Image1(9).Visible = True Then
Image1(9).Visible = False
Image1(10).Visible = True
GoTo g:
End If
If Image1(10).Visible = True Then
Image1(10).Visible = False
Image1(11).Visible = True
GoTo g:
End If
If Image1(11).Visible = True Then
Image1(11).Visible = False
Image1(12).Visible = True
GoTo g:
End If
If Image1(12).Visible = True Then
Image1(12).Visible = False
Image1(13).Visible = True
GoTo g:
End If
If Image1(13).Visible = True Then
Image1(13).Visible = False
Image1(0).Visible = True
GoTo g:
End If
g:
If Timer1.Enabled = True Then
plu(1) = plu(1) + 1
Timer1.Enabled = False
Timer1.Enabled = True
If plu(1) = chislo Then
Timer1.Enabled = False
plu(1) = 0
If Image1(0).Visible = True Then
MsgBox "Hello! Image1(0)"
End If
If Image1(6).Visible = True Then
MsgBox "Hello! Image1(6)"
End If
If Image1(8).Visible = True Then
MsgBox "Hello! Image1(8)"
End If
If Image1(12).Visible = True Then
MsgBox "Hello! Image1(12)"
End If
Command1.Enabled = False
Command2.Enabled = True
End If
End If
End Sub