Timing App

Line: Forms Line
Medium Difficulty Forms Learning Outcome One Learning Outcome Two Learning Outcome Six Exercise
Type: Exercise
You should have completed: Calculator This topic leads to: Car Dealer

Summary

A fundamental difference between programming windows apps and console apps is that the timing of events happens at the user's discretion. As they interact with the interface, the program responds. In comparison console applications do something and then demand interaction from the user.

Sometimes however, you want an application to do something at a regular interval, whether the user is interacting or not, such as update the latest data, or the time. This can be achieved with the invisible Timer control. This triggers events at regular intervals (set by properties on the control) which can then be used to make something happen in your program.

Task

  1. Create a Windows Forms application
  2. Using the form designer, create an interface for a simple timing app. Perhaps something like this:
    Example Interface
  3. Use the Timer control to make this app function as a countdown timer. Hint: You can't rely on the timer to precisely trigger events at a constant rate, you will need to find out how to accurately determine time.
  4. Fully test your program.

Questions

  1. Can you modify your app to have a stopwatch function and record individual 'lap times'?