[HELP] Visual Studio - Count up timer
2014-06-05, 03:34 AM,
(This post was last modified: 2014-06-05, 03:38 AM by Adept.)
#1
I need more assistance with Visual Studio. With the help of a video tutorial I found on YouTube I made this count up timer: [Image: c9TwRdo.png]
But as you can see, it's in this format: 00:00:x until it reaches 10 seconds. How can I change it to this format: 00:00:0x
example: 00:00:01 (and not 00:00:1)

Timer code:
Code:
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        seconds_label.Text = seconds_label.Text + 1
        Timer2.Interval = 1000
        If hours_label.Text = "" Then
            hours_label.Text = "00"
        End If
        If minutes_label.Text = "" Then
            minutes_label.Text = "00"
        End If
        If seconds_label.Text = "" Then
            seconds_label.Text = "00"
        End If
        If hours_label.Text = "00" Then
            hours_label.Text = "00"
        End If
        If minutes_label.Text = "00" Then
            minutes_label.Text = "00"
        End If
        If seconds_label.Text = "00" Then
            seconds_label.Text = "00"
        End If
        If seconds_label.Text = "60" Then
            minutes_label.Text = minutes_label.Text + 1
            seconds_label.Text = "00"
        End If
        If minutes_label.Text = "60" Then
            hours_label.Text = hours_label.Text + 1
            minutes_label.Text = "00"
        End If
        If hours_label.Text = "59" Then
            If minutes_label.Text = "59" Then
                If seconds_label.Text = "59" Then
                    Timer2.Enabled = False
                    MsgBox("Timer can't continue counting")
                End If
            End If
        End If
    End Sub

Thanks in advance,
AdeptMT

[Image: R5I6Tcg.gif]
Reply
2014-06-05, 04:18 AM,
#2
Code:
If Convert.ToInt32(seconds_label.Text) + 1 < 10 Then
  seconds_label.Text = "0" & seconds_label.Text + 1
Else
  seconds_label.Text = seconds_label.Text + 1
End If
Latest Thanks - View all

Adept(2014-06-05 04:31 AM) 
Reply
2014-06-05, 04:31 AM,
#3
(2014-06-05, 04:18 AM)x00srch Wrote:
Code:
If Convert.ToInt32(seconds_label.Text) + 1 < 10 Then
  seconds_label.Text = "0" & seconds_label.Text + 1
Else
  seconds_label.Text = seconds_label.Text + 1
End If

Works like a charm. You're the boss, man.

[Image: R5I6Tcg.gif]
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Visual studio/basic miamor 6 247 2017-03-07, 10:37 PM
Last Post: miamor
  Please help! I want to know how to make number count video fake proof Opeyemidy 9 388 2017-03-07, 01:59 AM
Last Post: sltons
  Visual Basic Question Daenerys 2 287 2017-02-24, 10:52 PM
Last Post: imonambot
  Facebook Like Box With Timer GhostxScripter 4 868 2016-08-27, 12:16 AM
Last Post: GhostxScripter
  Does video views on facebook count on Youtube ? Lemonzer 4 671 2016-07-07, 04:23 PM
Last Post: taiyang




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top