AdvancedHMI Software

General Category => Support Questions => Topic started by: Cowboy1 on August 18, 2015, 08:23:59 PM

Title: Timer2 error
Post by: Cowboy1 on August 18, 2015, 08:23:59 PM
I have 1 of these Timers running on 3 pages to keep cycle time.
Code: [Select]
Private timer As Stopwatch
    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        Label25.Text = String.Format("{0}:{1:d2}:{2:d2}", Me.Timer.Elapsed.Hours, Me.Timer.Elapsed.Minutes, Me.Timer.Elapsed.Seconds)
    End Sub

For some reason this one will not work it builds and solution loads but I get the following error when the I click the start button for the cycle:




Title: Re: Timer2 error
Post by: Cowboy1 on August 18, 2015, 08:59:38 PM
Solved: I have been starring at this way too long. I missed a piece of code on my button to start the dang timer.

I had the first line but not the second:
Timer1.Start()
        Me.Timer = Stopwatch.StartNew

Sorry for wasted post, time to call it a night.