Hello today I will be showing you how to make a flashing digital clock. To create one follow these directions.
1) Create a new windows form application. (Name what ever you want)
A windows form application will build a program interace where you can add contols to.

2) Add a label to the form. If you can't find the label click on the toolbox that is on the left side of visual basic.(The label will show the date and time so resize your form close to what you think it would be with that text.)

3) I recommend you rename the label lblDateAndTime so that if someone else was looking at your project (or you) would understand what that label is exposed to do.

4) Add two timers to the form. To get a timer goto the toolbox and scroll down until you find it double click on it. Goto the properties of the timer/s and set the interval to any number, this will update the text by milliseconds so lets say you put in 70 milliseconds the text will change colors every 70 milliseconds.(or drag it to the form. One would suffice but I use two to ensure the program don't slow down.)
5) Here is where we start adding code:

6) For form1's load event add this code:

Timer1.Start()
Timer2.Start()

(Or if you have one timer.)

Timer1.Start()

The reason we use

Timer1.Start()

is so that when the user opens the application the program will start doing what ever you put into the timers tick event.

7) Add this code to timer1 tick event

lblDateAndTime.Text = DateAndTime.Now

. We want our label to say the current date but we also want the label to keep updating its text thats why for the form 1 load event we have this code

Timer1.Start()

this will interact with timer 1's tick event so that the text of the label will keep updating. (If you have one timer.)

When ever you want text or a form to flash you need to start the code with the current color of the form or text, in the middle of the code there would be all the colors you want the text to be, the last piece of that code will be the same color as the form or text. This will make the text keep changing colors even when it reaches the end of the code.

Replies To: How to use timers to make a flashing digital clock

In a tutorial you typically want to tell everyone what is going on at each step rather than just showing code. Someone who would read this tutorial may be a newbie and don't know what the code is doing or why. Tutorials teach and is more involved than merely showing code and where to put it. Keep this in mind and you may want to either update this tutorial or write better explanations in future tutorials.

In a tutorial you typically want to tell everyone what is going on at each step rather than just showing code. Someone who would read this tutorial may be a newbie and don't know what the code is doing or why. Tutorials teach and is more involved than merely showing code and where to put it. Keep this in mind and you may want to either update this tutorial or write better explanations in future tutorials.