Creating a clock in VB2010

Creating a clock in VB2010 is pretty easy. First of all you need to insert a timer control into your form and set its interval to 1000, which is equivalent to 1 second. Next, insert a label, clear its text and set an appropriate size(you need to disable autosize).

Now click on the timer and key in the following code:

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Label1.Text = TimeOfDay

End Sub

Execute the code and you have your clock up and running.