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!
VBBRettAsked:
Who is Participating?
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.