ProgressBar Clock in VB.NET

Today, I will teach you how to create a program that displays a clock using the ProgressBar in VB.NET. Now, let's start this tutorial! 1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application. 2. Next, add a Timer named Timer1. Insert 3 ProgressBar named ProgressBar1, ProgressBar2, and ProgressBar3 for Hour, Minute, and Seconds, respectively. Insert also labels such as lblTime for the real time, lblHour for the hour, lblMinute for minutes, and lblSec for seconds., You must design your interface like this: clock design 3. Now lets code for our Form. We will have first to code the Timer1 as it ticks and will breakdown the time into hours, minutes, and seconds to display the time value of the progressbars and labels.
  1. Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  2.  
  3. 'progressbars and labels
  4. ProgressBar1.Value = Convert.ToString(DateTime.Now.Hour) 'Hour
  5. lblHour.Text = Convert.ToString(DateTime.Now.Hour)
  6. ProgressBar2.Value = Convert.ToString(DateTime.Now.Minute) 'Minute
  7. lblMinute.Text = Convert.ToString(DateTime.Now.Minute)
  8. ProgressBar3.Value = Convert.ToString(DateTime.Now.Second) 'Seconds
  9. lblSec.Text = Convert.ToString(DateTime.Now.Second)
  10.  
  11.  
  12. End Sub
Now, we will code for the Form_Load so that it will display the exact calibration of the time such as hours, minutes, and seconds. Also, it will display the real time on our label.
  1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.  
  3. 'hour
  4. Label6.Text = " 1 5 10 15 20 23"
  5. Label5.Text = "| | | | | | | | | | | | | | | | | | | | | | | |"
  6. 'minute
  7. Label7.Text = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |"
  8. 'seconds
  9. Label9.Text = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |"
  10.  
  11. 'date
  12. lblTime.Text = DateTime.Today.ToLongDateString()
  13.  
  14. End Sub

Output:

output For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below. Best Regards, Engr. Lyndon Bermoy IT Instructor/System Developer/Android Developer/Freelance Programmer Mobile: 09488225971 Landline: 826-9296 E-mail:donbermoy@engineer.com Add and Follow me on Facebook: https://www.facebook.com/donzzsky Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

Add new comment