Anda di halaman 1dari 1

Lesson 6

Timer
Timer Properties

OBJECTIVES:
1. Value the importance of Timer in Visual Basic.
2. Explore timer through Example.
3. Develop your knowledge and skills using timer.
Timer
The Timer control works in the background you do not see it on the

Form at runtime. The primary purpose of a Timer is to trigger an event at a


certain interval. The following are the properties of a Timer.

Property

Description

Enabled

Determines whether the Timer can respond to events.

Index

Specifies the subscript of the control in a control array.

Interval

Specifies the number of milliseconds between calls to a Timer


controls Timer event. The value must be within the range of 1 to
65535. This value is in millisecond (or a thousandth of a second).

The Timer has one event, the Time event. The procedure <timer_name>.

Timer( ) is executed every <interval_value> milliseconds.

The Timer control continues this until we disable the control by setting
the Enabled property to False.
In the following example, I use a very simple technique to show animation
by using the properties Visible=False and Visible=true to show and hide two
images alternately. When you click on the program, you should see the following
animation.

Anda mungkin juga menyukai