O'Reilly logo

Learning C# 3.0 by Brian MacDonald, Jesse Liberty

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

Chapter 18: Creating Windows Applications

Quiz Solutions

Solution to Question 18-1. The various widgets on a Windows form are all known as controls.

Solution to Question 18-2. To add a Button control to a Windows form in Visual Studio, simply drag the Button from the Toolbox onto the form wherever you want it. Visual Studio takes care of the code to initialize the control.

Solution to Question 18-3. To set the properties of a control, click on the control on the form. This causes the control’s properties to appear in the Properties window. From the Properties window, you can set a number of available properties for each control.

Solution to Question 18-4. Windows is an event-driven environment in that the code initializes forms that wait to respond to user or system actions—events—rather than running procedurally from start to finish.

Solution to Question 18-5. To make a button respond to being clicked, you need to create an event handler to handle the Click event for the button.

Solution to Question 18-6. The two ways to create an event handler in Visual Studio are as follows:

  • Go to the Properties window, click on the lightning bolt button to open the events, and then fill in a name or double-click next to the event to let Visual Studio create the name.

  • Double-click on the control to create the default handler with a name provided by Visual Studio.

Solution to Question 18-7. When you create an event handler for a control on your form, Visual Studio automatically takes you to the code page ...

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