1. The Timer Uses
Southern Technical University
Basra Technical University
Department of Electrical Power Techniques Engineering
Student name:
يسحنلعيترمضى
Supervisor:
دعسأدالخ .م
Study / Stage:
اسمئ)يB( ثانية
Course:
Computer Programming
2019 / 2020
2. Introduction
The timer tool is often in need of making us some events
fall after a certain period of time and without entering the
program user and this can do it using the TIMER tool and
the Tick event. The Timer object is really what is invisibly
lets you handle the computer hours from within programs
that you carry out.
When we have timer on the model, it is active on the
equal time periods called intervals and the result of this
activity event is the Tick event (ETT event such as the Click
event or Mouvemouse but special for the Timer object).
The user uses much and will need to use it in many
applications (knowing your birth date and remind you on
the selected day and know when a staff member is set in
the company, calculate the number of years of work to a
one of the parties, a work process for a certain period and
then stopped ...)
3. Add timer for the model
This tool is located in the Toolbox tool box as primarily
clicking and passed by the model for a fee appear in a
bottom ribbon below you can define as a variable as:
DimTimer1 as a time
Note
: If you do not find this tool in the toolbox, do any:
1place anywhere on the Toolbox toolbox, press the right
click on the right click on the selection of the selection box
of the
2click on a top of the toolbox. Net Framework
Components
3 - Search the tool within this tab and find it in place to
place a correct mark and press OK for which the TV tool
has been added.
4. The most important features of the tool
Enables and the Interval property are the main
importunateness of this tool and that you will use them as
two basic two cases when using the tool enabled the
property takes the True or False value and the default
value of its False and you have to make them true if you
want to run the mixes and if you want to stop the Timer to
make it False You can change this property to True or False
while running the program and during the design.
Interval property determines the time period after which
the meter is activated and ranging from 0 to 65535 ms.
Second = 1000 milliseconds
If it has: timer1.interval = 2000 will be mixed after two
seconds.
Example :
To create a simple timer that is used in sports
competitions such as running, for example, here we will do
the following:
We first design the interface, by adding the timer, the
command and the label, as shown in the image below
5. After that we rename the command, set the timer
settings, and customize the form (as shown in the
image below) by double clicking inside the form and
we enter the following:
Private Sub Form_Load()
Form1.Caption = "stopWatch"
Command1.Caption = "start"
Timer1.Enabled = False
Timer1.Interval = 100
End Sub
6. Then we customize the command, by double-clicking
on it and we set it to change its name with the start
of the timer and in order to determine the start of the
timer (which will start from 0s) :
7. Private Sub Command1_Click()
If Command1.Caption = "start" Then
Command1.Caption = "stop"
Timer1.Enabled = True
Label1.Caption = "0"
ElseIf Command1.Caption = "stop" Then
Timer1.Enabled = False
Command1.Caption = "start"
End If
End Sub
After that, we set the timer output to increase it
adding 0.1 seconds during every 100 ms (after
8. allocating the interval in the form to be 100 ms) as in
the image below:
Private Sub Timer1_Timer()
Label1.Caption = Val(Label1.Caption) + 0.1
End Sub
By this we have finished the simple timer design and we
will operate it and see the result as shown in the pictures
below: