VB.Net creating digital clock

Creating digital clock in Visual Basic.Net

In this tutorial of visual basic.net we are going to create a very simple digital clock, this is going to be a very easy tutorial of visual basic, because it is very easy to create a digital clock with the help of vb.net.

Let`s start with creating digital clock in vb.net.

Step 1 –

Very first we have to drag and drop a label control on our form control.

 

digital clock in vb.net

Step 2 –

Now simply drag and drop a timer control our form control.

 

vb.net digital clock

Now let`s code for digital clock.

 

Public Class Form1
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.Text = "Digital Clock"
        Me.BackColor = Color.Tomato
        Me.MaximizeBox = False
        Label1.Text = "00:00:00"
        Label1.Font = New Font("Comic Sans MS", 25, FontStyle.Bold Or FontStyle.Underline)
        Label2.Text = "www.programmingocean.com"
        Label2.Font = New Font("Comic Sans MS", 10, FontStyle.Bold Or FontStyle.Underline)
        Timer1.Enabled = True
        Timer1.Interval = 1
    End Sub
    Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
        Label1.Text = TimeOfDay
    End Sub
End Class

Output.

visual basic.net digital clock