Breaking News
August 6, 2015

Creating a Live Timer in VB.NET

Thursday, August 06, 2015

Creating Live Timer in VB.NET - Geeky Juan
Hi there! A busy month it has been and we've been lacking the time to update the site but nevertheless, thanks for still tuning in! Today, we'll be sharing the steps on making a Live Timer in a Windows Form Application. Of course a WPF has a much better interface and hopefully, we could tackle that in the near future. Let's get started shall we?
  1. Add a Timer in your Windows Form from the ToolBox
  2. Set your Timer's properties to 'Enable' and...
  3. Change the Timer's Interval from 100 to 1000
  4. Add a Label that will hold your Timer.
  5. Double Click your timer to set its 'Tick' action
  6. Set your label to receive the time in that 'Tick' action (see the example provided below)
  7. Set your Timer to start on Form Load (see the example provided below)
For the code that you should place on your 'Tick' action. Just add the code as highlighted in the given code below. TimeOfDay will display the current System Time on your system unit.
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        YourLabel.Text = TimeOfDay
    End Sub
While for the code you should place on your Form Load, You should now start your timer by placing the following code. Your reference would be the highlighted code.
 Private Sub HomeForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
 End Sub
I hope this could be beneficial to our Script Kids out there. Basic, indeed it is but all experts were once beginners right? Just continue practicing your coding skills and eventually you'll make it through it!

Oh, and another thing, the code provided is done in Visual Studio 2013.

'Til next time!
Share your thoughts


Post a Comment

Toggle Footer
Web Statistics