|
11.06.08 Implementing TimeClass Into .Net Framework By
Shabbir BhimaniThe 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.
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
|
|||||||
|
| ||
|
-- 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 |