Link to home
Start Free TrialLog in
Avatar of Larry Cutliffe
Larry CutliffeFlag for United States of America

asked on

VB Timer

This should be pretty simple but for some reason Im not graspin how to utilize the timer code  in VB 2005. I'm workin on practice excersises as I'm learning how to write this stuff and one of the projects I am working on is just making a simple window with a box showing the date and time. I have been instructed to insert a timer to update the clock every second but I'm not sure of the code to make the timer do exactly that. It is in the form but I need to get some help on what to write and where to put it to make the time update. *Note* - On the form I already have the timer enabled with an interval of 1000.

This is what I got so far.

Public Class Form1


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Time1 As Date
        Time1 = Now
        lbl2.Text = Time1
        lbl2.Text = Format(Time1, "h:mm:ss")

    End Sub

End Class

Its pretty simple but for some reason i cant find the answer i'm lookin for.
LC
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jorge Paulino
And don't forget to set the Interval = 1000 (1000 = 1 second)
Avatar of Larry Cutliffe

ASKER

Thank you sir, you freed me from my sticking point.

LC