Learning Just About Timers In VB.NET

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
3,926
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Feb 26, 2009

Here's a tutorial that will show you how to make a timer that really is based on seconds changing...

Unlike using timers that go off every 1000ms my application bases itself off, real seconds changing.

Things You Might Need...

1. (5) Labels (LYears, LDays, LHours, LMinutes, LSeconds)
2. (1) Timer (TSec)
3. (5) Group Boxes (Years, Days, Hours, Minutes, Seconds)
4. (1) TextBox (LSec) "Make Not Visible at Compile Time"

----------------------------------------------------------------------

Form1.vb

Private Sub LSec_TextChanged

LSecond.text = LSeconds.text + 1

End Sub

Private Sub TSec_Tick

LSec.Text = TimeOfDay.Second

'If LSeconds Equals 60, It Equals 0, add 1 To LMinutes
If LSeconds.Text = 60 Then
LSeconds.Text = "00"
LMinutes.Text = LMinutes.Text + 1

'If LMiniutes Equals 60, It Equals 0, add 1 to LHours
If LMinutes.Text = 60 Then
LMinutes.Text = 0
LHours.Text = LHours.Text + 1

'If LHours Equals 24, It Equals 0, add 1 to LDays
If LHours.Text = 24 Then
LHours.Text = 0
LDays.Text = LDays.Text + 1

'If LDays Equals 365, and LHours Equals 6, add 1 to years
If LDays.Text = 365 And LHours.Text = 6 Then
LDays.Text = 0
LHours.Text = 0
LMinutes.Text = 0
LSeconds.Text = 0
LYears.Text = LYears.Text + 1

End If
End If
End If
End If
End Sub

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 3 dislikes

Link to this comment:

Share to:

Top Comments

  • Hey nice video...and do u know how to make a download manager of some sort...like Free Download Manager...in VB 2008? PM me is u have an answer...thanks

  • Nice video! But can you make a countdown program?

see all

All Comments (7)

Sign In or Sign Up now to post a comment!
  • yeah the music sounds like his ass is trying to poop... but cant... go and jump off the building and commit suicide you dumb shit... talentless dog..

  • Why did you destroy a good tut with simple stupid music!!! It was to loud and you can't hear what your going on about. Bad mistake

  • Type "visual basic 2008 countdown program" in YouTube and select the first video.I think you mean this!

  • well i dont see wats so special about the 5 milliseconds on the timer, y dont u just set it to 1 and when it reaches 100 its a new second? Its seems like u went through a lot more than u needed to...

  • My timer doesn't work!

    help me please...

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more