[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 393
  • Last Modified:

How do you get a count down timer in your windows form app?

I need a count down timer, please show me how to code the count down timer in my windows form app.  Thank you.  i would need this done in visual basic.  The idea is to get it to run the count down and when it hits zero, it executes a process by clicking a certain button.  Thanks!
0
VBBRett
Asked:
VBBRett
2 Solutions
 
MageWindCommented:
Here's some code that should work.  Let me know if you have any questions!
'Put in form
    Dim WithEvents myTimer As New Timer()
    Dim time As Integer = 5000 'Measured in miliseconds


    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        myTimer.Interval = 1000
        myTimer.Start()
    End Sub

    Private Sub myTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles myTimer.Tick
        time -= myTimer.Interval
        If time <= 0 Then
            myTimer.Stop()
            'call code that you want executed
        End If
    End Sub

Open in new window

0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
I thought we answered this for you pretty well a couple of days ago?...
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_24980389.html#26055294
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now