VB6 Tutorial 46: Basic Animation

Posted On 2018-05-08 by VB6Boy
Tags: VB6 Tutorials 
Views: 43

Title Uploaded Size
Stopwatch.zip 5/8/2018 4:49:30 PM 2,252
DigitalClock.zip 5/8/2018 4:44:11 PM 1,619

Looking for the more of the VB6 Tutorial? Here is the tutorial index.

This lesson is about the Timer control in VB6. It's simple and interesting.

Timer control is used to execute lines of code at specific intervals. Using this control, you can create animations without any knowledge of graphics or animation. Though you cannot create some groundbreaking animations using timer control, but it is sufficient for your application. You can create an animated menu for your software. This control is not visible at runtime.


The two properties that you'll want to start off with are Enabled and Interval. There are others, but let's not muddy the waters. Until later.

  • Enabled: To activate or deactivate the timer.

  • Interval: Number of milliseconds between calls to a timer control's timer event.

    For example, set the Interval to 100 , to execute the code in the timer event procedure every 100 milliseconds.

    1000 milliseconds = 1 second.


    Place a Timer control and a CommandButton on the form. Set its Enabled property to False and set the Interval property to 1.

    Private Sub cmdStart_Click()
        Timer1.Enabled = True   'Enables the Timer
    End Sub
    Private Sub Timer1_Timer()
        Form1.Width = Form1.Width + 1
    End Sub

    Now run the program and click on Start button to start the Timer. Once the Timer is enabled, the code in the Timer procedure is executed every 1 millisecond and it increases the width of the current form in the above program example.

    Check out the attached example projects for demonstrations of usage for the timer control, and you'll see how it can be used for a variety of purposes.

    Looking for the more of the VB6 Tutorial? Here is the tutorial index.

    About the Author

    has posted a total of 78 articles.

    Comments On This Post

    No comments on this post yet!

    Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

    Or you can drop a note to the administrators if you're not sure where you should post.

    Your IP address is:

    Before you can post, you need to prove you are human. If you log in, this test goes away.

  • Code Links