Objectives:

  • Create a Visual Basic Clock

The Digital Clock



  1. Create a new Visual Basic Project.

  2. Drag a label onto the form.

  3. Erase the caption. Leave the caption property blank.

    Note: The caption property is not the same as the name property. The name property is at the very top of the list of properties.

  4. Change the name property of the label to lblTime.

  5. Change the font property of the label to a style and size you like.

  6. Take a look at the timer icon on your tools.



  7. Drag the timer icon onto the form.

  8. Change the Interval property to 1000.

  9. Double-click the timer button and add the following code:
    lblTime = time

  10. Drag a command button onto the form.

  11. Double click the command button and add the following code:
    end

  12. Test your program.

  13. Repeat the process to make an additional timer that uses a different font to display the time. Note: When you add a second label, you must use a different name. Name it lblTime2. When you write the code for the second timer, you will type: lblTime2 = time

  14. Change the background colors and add descriptive labels and graphics to your program.


<< Back to Skyline