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

Posted on 2009-12-17
Last Modified: 2012-05-08
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!
Question by:VBBRett
    LVL 3

    Accepted Solution

    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
        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
                'call code that you want executed
            End If
        End Sub

    Open in new window

    LVL 85

    Assisted Solution

    by:Mike Tomlinson
    I thought we answered this for you pretty well a couple of days ago?...

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now