C Programming Tutorials and advice
CProgrammingTrends News Archives About Us Feedback

Recent Articles

C++ Criticisms Mobilize Fan Base
C++ is under attack, and instead of some random individual, well-known programmer and author Eric Raymond is the person conducting it. We'll cover his assessment, then, along with some of the numerous rebuttals and an overall effect that's surprisingly...

C Books On Top In India
Remember the Tom Clancy years? Or maybe Stephen King's string of successes? Although that second example isn't a great one, a look at book sales can be a good way of judging what concerns or interests a nation. And it...

What Are The Programming Language Names?
PHP has come a long way in the last few years and now its one of the most popular known web language but has any one of us thought why the Name of the language is PHP and nothing else Or what is the full form of PHP.

Demand For Programmers Remains Strong
A disheartening piece of news came out today: unemployment is at a four-year high. Sooner or later, it seems the people in charge of this country's economic system will have to admit a recession is taking...

C# Guidebook Gets Good Reviews
If you're looking for a book about the C# programming language, we may (or may not) have one to recommend. Reviews of Head First C# have indicated that there's a lot to love and a little to dislike. To get a discussion...

Microsoft's IronRuby Integrates Into Dot Net...
Microsoft introduced IronRuby at the RailsConf in Portland, with integration into dot net and silverlight, this is a good thing, as showing off integration like this is...


11.06.08

Implementing TimeClass Into .Net Framework


By Shabbir Bhimani

The timer class is often used in many applications. It's very simple for using, like all the classes implemented in .Net Framework.

So create a C# Console project, we will try this class in a console application.

Include this namespace, so we can use the Timer class



In the above code we are creating an object from the Timer class, set his interval so 1000 miliseconds, create an event which will be invoked every 1000 miliseconds and enable the timer.
Then we write some text to the console, just for information for the user how to exit from the application. And the last line stops the program to end, and waits for user input.

Improve your competitive advantage with the white papers in this eKit: Download Now

Below the main function create this event



In the end you can exclude the unused usings, showed in this post.

Now start the application, it will write on the console the actual time every second. Press Enter to exit.

You can put diferrent code in the tm_Elapsed function, so that code will execute every second or the interval you will set.

Download the project from here.

Comments

About the Author:
Shabbir Bhimani is a developer in the field of Applications, web as well as database designing for more than 5 years now and is devoted to the optimization and usability of the code. Shabbir shares his development experience through his blog Code It Well and is an active member of Programming and web development forum.
About CProgrammingTrends
A collection of articles and tutorials designed to help C and C variant programmers in their programming work. C Programming Tutorials and advice





CProgrammingTrends is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com ITmanagmentNews.com





-- CProgrammingTrends is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2008 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal


archives | advertising info | news headlines | free newsletters | comments/feedback | submit article

">Unsubscribe from CProgrammingTrends.
To unsubscribe from CProgrammingTrends or any other iEntry publication, simply send an email request to: support@ientry.com

CProgrammingTrends Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact