Sunday, November 25, 2007

Timers on Visual Basic


Tick tock tick tock!!

Today in Visual Basic we learned how to create digital clocks, in which the time changes automatically after a certain time interval. In this case, the time interval is set to 1000 milliseconds, or 1 second. On a new form, we created a label in which the time would display as the caption, and a command button to close the program. Here is a sample of what the program would look like in code view:

__________________________

Private Sub cmdExit_Click()
Unload Me
End
End Sub

Private Sub Form_Load()
tmrTimer.Interval = 1000
End Sub

Private Sub tmrTimer_Timer()
lblTime.Caption = Time
End Sub

__________________________

Until next time!
--->ELIZA!

No comments: