Author Topic: Timer2 error  (Read 985 times)

Cowboy1

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Timer2 error
« 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:





Cowboy1

  • Jr. Member
  • **
  • Posts: 65
    • View Profile
Re: Timer2 error
« Reply #1 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.