How to Make a Timer in Visual Basic

A timer in Visual Basic will permit the developer to have a predetermined activity happen on his operating system after a certain period in time. The developer determines what the activity is and what time period will be. Follow these steps to create a timer in Visual Basic.

Instructions

    • 1

      Open up your Visual Basic program. Make one button. Enter this code under the button_click sub: MsgBox ("HELLO I'M A MSG BOX PROMPT").

    • 2

      Double click on the icon of the clock that is located on the left hand side of the screen.

    • 3

      Disable the timer so that it does not do something without being programmed with what to do. On the first line type "Private Sub Form_Load()" then on the second line type "Timer1.Enabled = False" On the third line type "End Sub."

    • 4

      Program the timer to do something. On the first line type "Private Sub Command1_Click()" then on the second line type "Timer1.Enabled = True" On the third line type "End Sub."

    • 5

      Enter some code to stop the timer from endlessly repeating itself. On the first line type "Private Sub Timer1_Timer()." On the second line type "MsgBox (HELLO I'M A MESSAGE BOX PROMPT")." On the third line type "Timer1.Enabled = False" and on the fourth line type "End Sub."

Tips & Warnings

  • Code-based timers are dependent upon the capacity of your operating system's load. Close all applications before making a timer in Visual Basics.

Related Searches:

Resources

Comments

  • hasan4it Nov 01, 2009
    What is the minimum time interval for the timer

You May Also Like

Related Ads

Featured