Tuesday, October 5, 2010

Visual Basic Date and Time Event : Timer

Purpose : The Timer event contains the actions that take place when a time equal to the interval value of the timer control has elapsed. this event triggers every time the interval of time elapses until the timer control is disabled . A timer control is disabled by setting its Enabled property to False , by setting its Interval property to 0 , or by unloading the form.

Syntax :
Sub Name_Timer ( [ Index As Integer ] )

Name : Name property of the timer
Index : Serves as a reference for the part of a control array

Option Explicit
Dim x%, y%, Radius%
Const pi = 3.14159265

Private Sub Timer1_Timer()
Cls
Static num As Double
FillColor = QBColor(1)
FillStyle = 1
x% = ScaleWidth / 2
y% = ScaleHeight / 2
Radius% = ScaleWidth / 4
Circle (x%, y%), Radius%, num, -6.283
num = num - ((2 * pi) / 60)
Text1.Text = Str$(num)
If Abs(num) >= 6.238 Then
num = 0
Timer1.Enabled = 0
Cls
End If
End Sub

No comments:

Post a Comment