I have managed to successfully add two counters, on which counters from 00:00 and the other from 00:45. The problem i have though is that the counter resets to 00:00 when the counter reaches 60:00 minutes. I need the counter so that it goes to 100:00 or more.

 Dim starttime As DateTime
    Dim timedifference As TimeSpan

    'Timer which starts the count from 00:00'
    Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
        Dim timedifference As TimeSpan = DateTime.Now.AddMinutes("00").Subtract(starttime)
        Dim newdate As DateTime = timedifference.ToString
        Label7.Text = newdate.ToString("mm:ss")
    End Sub

    'Timer which starts the count from 45:00'
    Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
        Dim timedifference As TimeSpan = DateTime.Now.AddMinutes("45").Subtract(starttime)
        Dim newdate As DateTime = timedifference.ToString
        Label7.Text = newdate.ToString("mm:ss")
    End Sub
End Class

Maybe have a global variable called secondscounter and another timer that fires every minute and it increases that increases secondscounter by 1 each time it ticks, when secondscounter hits your total time you need then reset secondscounter to 0 and do whatever you wanted to do after the 60+ minutes. Just a thought but should work.

hope it helps,
Larry

Why not use one Timer and let it count in seconds.
Every time you want to display minutes and seconds, you divide the number of seconds by 60. This will give you the minutes. The remainder are seconds. Use the modulo operator.
Example: say your timer counts 4567 = N.
To display:
N \ 60 = 76 minutes
N Mod 60 = 7 seconds
Format this in a string as: 76:07 or whatever format you like.

Edited 2 Years Ago by ddanbe: addition

Sorry guys, i'm not really familar with the terms you're using. I'm quite a newbie to visual basic. I understand what you're saying, i just don't know how to implement it.

Edited 2 Years Ago by pbarks1

hi i just need the timer up to 5 hours thanks!!! love aslan and heres a link if you want to have the timer for you!!!:Click Here bye and enjoy!!!

    Public MinutesCounter as Int = 0 'place this right below the Public Class so it is not in any of the Subs or Functions

    Dim starttime As DateTime
        Dim timedifference As TimeSpan
        'Timer which starts the count from 00:00'
        Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
            Dim timedifference As TimeSpan = DateTime.Now.AddMinutes("00").Subtract(starttime)
            Dim newdate As DateTime = timedifference.ToString
            Label7.Text = newdate.ToString("mm:ss")
        End Sub
        'Timer which starts the count from 45:00'
        Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
            Dim timedifference As TimeSpan = DateTime.Now.AddMinutes("45").Subtract(starttime)
            Dim newdate As DateTime = timedifference.ToString
            Label7.Text = newdate.ToString("mm:ss")
        End Sub

        Private Sub TickTimer_Tick(sender As Object, e As EventArgs) Handles TickTimer.Tick
                'this is the new timer control tick function that will be called
                'every minute
            MinutesCounter = MinutesCounter + 1 'just increments the count of minutes that you will watch for
                'now you check for the minutescounter to be above the time you 
                    'want to watch for
                'so if you want a 60 minute timer just perform a check if 
                    'MinutesCounter>=60 then do what you want to do
            if MinutesCounter>=60 then
                'perform whatever it is you want to perform after that long 
                    'timeframe inside this if then
                'then reset the timer so it can be reused
                MinutesCounter=0

            End If
        End Sub

I am not sure how that will look when it posts but looked ok in the code window. Timers are just integers so they have a max of 64000 seconds I believe. So to get around it you will need a timer to get the minutes you need to watch for, this method should work for up to 64000 minutes. Create a new Timer called TickTimer and set the interval to 60000 milliseconds, so that it will tick every minute. Then place the variable dimension right below the Public Class call near the top of your code, that will make it able to be used by the entire app, so it does not forget the value (Public MinutesCounter as Int = 0). Then on every tick of TickTimer you increment that MinutesCounter and then check to make sure you do not pass the number of minutes you want to wait for to do whatever it is you want to do. That should do it, I think. If you need more help do not hesitate to ask. I hope this does help though at least some.

Larry

This timer will count forever in minutes

Imports System
Imports System.Drawing

Public Class Form1

    Dim secondsCount As Integer = 0
    ' change the above in Dim secondsCount As Integer = 45 * 60 to start counting at 45 minutes
    Dim minutes As Integer
    Dim seconds As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SecondsTimer.Interval = 1000    'set to 1 second
        SecondsTimer.Enabled = False    'do not start at startup
        Me.Text = "TIMER"
        Me.displayLbl.Text = ""
        Me.displayLbl.Font = New Font("Calibri", 48.0!, System.Drawing.FontStyle.Regular, GraphicsUnit.Point, CType(0, Byte))
        Me.displayLbl.ForeColor = Color.FromArgb(CType(CType(192, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer))

    End Sub

    Private Sub startBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startBtn.Click
        SecondsTimer.Enabled = True     'start counting seconds

    End Sub

    Private Sub stopBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopBtn.Click
        SecondsTimer.Enabled = False    'stop counting
        secondsCount = 0

    End Sub

    Private Sub SecondsTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SecondsTimer.Tick
        secondsCount = secondsCount + 1
        minutes = secondsCount \ 60     'div operator
        seconds = secondsCount Mod 60   'mod operator
        displayLbl.Text = minutes.ToString() & " : " & seconds.ToString()

    End Sub
End Class

Here is how it looks:
e35241d562efca02ca210b1ab0a264a8

Thanks ddanbe, will give that a try.

Just did it without problems but it's coming up with single digits. So when counting it goes 0:40 seconds instead of 00:40 which i would prefer.

Edited 2 Years Ago by pbarks1

try changing this

displayLbl.Text = minutes.ToString() & " : " & seconds.ToString()

to this

displayLbl.Text = minutes.ToString("D2") & " : " & seconds.ToString("D2")

Edited 2 Years Ago by Jefferson_1

This question has already been answered. Start a new discussion instead.