codice:
Dim TempoTrascorso As Integer
Dim TempoAllaFine As Single
Private Function ToSeconds(str As String) As Double
ToSeconds = Val(Mid$(str, 1, 2)) * 60 + Val(Mid$(str, 4, 2))
End Function
Private Sub Command1_Click()
TempoAllaFine = ToSeconds(Text1.Text) * 100
Timer1.Interval = 10
Randomize (Timer)
End Sub
Private Sub Command2_Click()
If Shape1.FillColor = &HFF Then
List1.AddItem (str(TempoTrascorso))
Shape1.FillColor = &H80
Randomize (TempoTrascorso)
End If
End Sub
Private Sub Timer1_Timer()
If Shape1.FillColor = &H80 Then
If Rnd() * 100 > 99 Then
Shape1.FillColor = &HFF
TempoTrascorso = 0
End If
Else
TempoTrascorso = TempoTrascorso + 1
End If
TempoAllaFine = TempoAllaFine - 1
If TempoAllaFine = 0 Then Timer1.Interval = 0
End Sub
Qui si presuppone che nel campo text1 si mettono i minuti/secondi in formato ##.##
Per il resto credo si spieghi da solo.