Countdown, the GUI Way

To put the icing on the cake for our running countdown example, let’s see what it takes to hook it up to a graphical user interface using our basic knowledge of Windows Forms.

Exploration of the various available controls is beyond the scope of this chapter, so you’ll have to take my word for it that appropriate controls are being used for the task at hand. We’ll keep the user interface as simple as we can, with a NumericUpDown control to select the number of seconds to countdown, a Button to start the timer, and a Label to display the current time. When the countdown has finished, a message box appears. Figure 18.26 shows the UI definition.

FIGURE 18.26 Countdown clock in Windows Forms.

Time to write some code! Double-click ...

Get C# 5.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.