How to Use the Timer in VB6

The Visual Basic 6 timer control lets you set up timed services on a Windows application. You specify an amount of time in milliseconds when the timer triggers a function. The function code executes, the timer control resets, and the timer counts down again. The timer control makes it convenient to schedule background tasks on a Windows computer. The timer control is included with the Visual Basic toolbox library.

Instructions

    • 1

      Click the Windows "Start" button and select "All Programs." Click "Microsoft Visual Basic," and then click "Visual Basic 6" to start the program. Open your project after VB6 loads.

    • 2

      Drag and drop a timer from the VB6 toolbox on the left of the window to the VB6 form you want to use to execute the timer. The timer control is invisible to the user, so you can add it to any form without altering your application layout.

    • 3

      Click the timer control on the form to activate the properties panel on the right side of your work space. Specify an amount of time in the "Interval" text box. The time is set in milliseconds, so each minute is 1000 milliseconds.

    • 4

      Double-click the timer control to load your VB6 editor. Whatever function opens is the function that runs when the time is reached.

    • 5

      Type an action for the timer to take when the time is reached. For instance, the following code displays a message when the timer function triggers:

      MsgBox "Your time has elapsed."

Related Searches:

References

Comments

Related Ads

Featured