O'Reilly logo

Learning C# 2005, 2nd Edition 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

Solution to Question 18–1.

Click on the control on the form, then set the properties in the Properties window.

Solution to Question 18–2.

Implement an event handler.

Solution to Question 18–3.

The two ways to create an event handler are as follows:

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

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

Solution to Question 18–4.

A method calling itself (such as calling MethodA( ) from within the body of MethodA( )).

Solution to Question 18–5.

XML documentation comments are preceded with three slashes, and are used to generate XML documents that can be used to document the application.

Solution to Question 18–6.

Click the ShowAllFiles button on the Solution Explorer and examine the <FormName>.Designer file.

Exercises

Solution to Exercise 18-1.

Create a Windows application that displays the word “Hello” in a label, and has a button that changes the display to “Goodbye.”

See the source code solution Chapter18Exercise1 on the web site for this book. Figure A-5 is a picture of the form.

Here is the event handler for the button:

private void button1_Click( object sender, EventArgs e )
{
   label1.Text = "Goodbye";
}
Exercise 18-1: the form

Figure A-5. Exercise 18-1: the ...

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