'------------------------------------- 'Author: Anne-Marie Wright 'Email: anne.wright@ukonline.co.uk 'Added: 26-June-2000 '------------------------------------- 'Program: STOPWATCH.ZIP '------------------------------------- 'Description: What I have done is create a small 'crude Stopwatch application the first one - stopwatch.zip 'does not use the timer control it is purely using the 'system clock. Stopwatch2.zip (also on the downloads page) 'is an enhanced version of the first one which 'uses both the system clock and a timer. ' 'Also in the example is how to create control arrays 'at run-time. I hope this is of some use. '------------------------------------- Option Explicit Dim timStart As Date Function TimeDifference(timLap As Date) As String TimeDifference = Minute(timLap - timStart) & ":" & Right("00" & Second(timLap - timStart), 2) End Function Private Sub cmdLap_Click() On Error GoTo cmdLap_Error Dim timLap As Date Dim strTime As String If Left(cmdLap.Caption, 3) = "Lap" Then If cmdLap.Tag = 5 Then MsgBox "Only 5 lap times are allowed" Exit Sub End If timLap = Time lblLap(cmdLap.Tag).Caption = "Lap " & cmdLap.Tag + 1 & ": " & TimeDifference(timLap) cmdLap.Tag = cmdLap.Tag + 1 cmdLap.Caption = "Lap " & cmdLap.Tag + 1 Else cmdLap.Tag = 0 lblTime.Caption = "0" lblLap(0).Caption = "" Unload lblLap(1) Unload lblLap(2) Unload lblLap(3) Unload lblLap(4) End If cmdLap_Exit: Exit Sub cmdLap_Error: Select Case Err.Number Case 340 Load lblLap(cmdLap.Tag) lblLap(cmdLap.Tag).Left = 3780 lblLap(cmdLap.Tag).Top = lblLap(cmdLap.Tag - 1).Top + lblLap(cmdLap.Tag - 1).Height + 20 lblLap(cmdLap.Tag).Visible = True Resume Case Else MsgBox "Error " & Err.Number & " - " & Err.Description Resume cmdLap_Exit End Select End Sub Private Sub cmdStart_Click() Dim timEnd As Date If cmdStart.Caption = "Start Timing" Then 'Start the clock timStart = Time cmdStart.Caption = "Stop Timing" cmdLap.Caption = "Lap " & cmdLap.Tag + 1 lblTime.Caption = "Running" Else 'Stop the clock timEnd = Time cmdStart.Caption = "Start Timing" cmdLap.Caption = "Reset" lblTime.Caption = TimeDifference(timEnd) End If End Sub Private Sub Form_Load() lblVersion.Caption = "Version: " & App.Major & "." & App.Minor & "." & App.Revision End Sub '------------------------------------- 'Burt Abreu 'http://www.VBExplorer.com '-------------------------------------