Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

VB Timer Tutorial

Loading...

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

Uploaded by on Jan 28, 2009

How to make a Timer

The code:

Public Class Form1 Dim m As String Dim s As String

Private Sub Form1_Load... Timer1.Enabled = True Timer1.Interval = 1000 Timer1.stop() End Sub

Private Sub Timer1_Tick... s = s + 1 If s = 60 Then s = 0 m = m + 1 End If Label.Text = m + ":" + s End Sub

Private Sub Button1_Click... Timer1.start() End Sub
End Class

  • likes, 5 dislikes

Link to this comment:

Share to:

Uploader Comments (Mixria)

  • oh wait... nvm on my other comment... i didn't notice part of the code there...

  • Did´t you got it to work?

  • for some reason i can't get it to work... there are no errors, no blue lines under the code... everything is fine, but it doesn't work for me

  • Try to remake it, some time the program just won´t.

    copy the text, close VB 08, start it up again, and paste the text.

    remember the toolbox items.

  • Thanks for the rating :-)

    The cod will be there in few seconds.

see all

All Comments (7)

Sign In or Sign Up now to post a comment!
  • pretty much in the timer tick event type in label1.text += 1

  • If you made a start button and coded it like this:

    Private Sub SartButton_Click()

    Timer1.Enabled = True

    and if you set the timer to enabled = false in the properties/code, would it work?

  • Nice ty I dont fully understand how to chane the clock to make it change when it gets to 20 sec

  • 5* Just what i needed any chance you could add code to "More Info" as its not to clear

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