O'Reilly logo

C# 5.0 Unleashed by Bart De Smet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required