• October 26, 2021


Bring Technology Ideas with you

 How to create a clock in VB.net Programming

Database Management System is one of the project which are mostly to apply for every bachelor students to be completed in their academic; however most of the system should have some features to show off their projects such as Calendar, clocks, etc. in their dashboard.

Design Form in VB.net

To create Clock in VB.net, you need to create project, by going to Visual Studio 2015( I used version 2015) then New Project after that in the Template –> Select VB.net. In the right panel, please select Window Forms Application.

    In the Name, please name as Digital Clock then click Ok

    Go to Toolbox in the left side of your Form1, then select Label and Timer to drop on your form then Name your Label to lbtime and Timer to DigitalTime. In your Timer, please change the Time Interval to 1000

      Start Coding in VB.net

      By double click on your Form1 then write the code in the Form_Load Event as below:

      Public Class Form1
          Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
              Me.DigitalTime.Enabled = True
          End Sub
      End Class

      On the Digital Timer which it were named from Timer, please double click on it the write the code below:

        Private Sub DigitalTime_Tick(sender As Object, e As EventArgs) Handles DigitalTime.Tick
                Me.lbtime.Text = "Current Date:" & Date.Now.ToString("dd-mm-yyyy hh:mm:ss")
            End Sub

        The result after click on Start:

          *** Date.Now.ToString(“dd-mm-yyyy hh:mm:ss”) is the build-in function which is coming with VB.net programming and it can be applied to any toolbox as you wishes

          Related post