How to make countdown timer in c#.net

Hello friends,
After a very very long time , lets grab some interesting stuff...
==================================================
Today I'll show how to make a countdown timer in c#.net.
==================================================
Step 1: first of all create a new project in c#.net (in visual studio)
              FILE>NEW > PROJECT > c# PROJECTS
Step 2 : Now we to set up a timer.
                  We will make a downtimer here which'll count in decrement way.
            Go to : Toolbars .
            Under " All Windows Forms " select timer.


Step 3 : Now a timer 1 will 
            appear at bottom of form.





Step 4: Click on timer and go to properties pane 
          . set Interval as 1000 
           This'll  set time interval of 1 second.


Step 5: Now double click on timer
             Write code :


            if (tl > 0)
            {
                tl = tl - 1;
                time.Text = tl + " seconds";
            }
            else
            {
               
                timer1.Stop();
                time.Text = "Time's up!";


Now FOR THIS SET PUBLICALLY 
   int tl=<the seconds you want to downcount timer>;

Here , in  time.Text  , time  is  a  text box name in which status will appear.


Step 6: That's it you will have timer like this when you'll build the form (Ctrl + F5)  :




==================================================
                                          ENJOY !!!!!!!!!!
==================================================


Comments

Anonymous said…
What is tl? nd Why did u not defined?

Popular posts from this blog

How to Install CCSM ( compizconfig settings manager ) in UBUNTU

Connecting JSP page with MS Access :: JDBC ODBC Connectivity

Accessing Webcam through Java - COMPUTER VISION