In this chapter, we will use the Code Snippets feature of Visual Studio to insert source code into a basic sample code framework. Code Snippets is essentially a hierarchical database of saved source code text. If you have installed the code for this book, you will find code snippets for most chapters included right in Visual Studio. In this chapter's project, I will show you how to use them to add chapter-specific code into your project.
Since we haven't officially started the Library Project, this chapter's project will simply extend the "Hello, World!" project we developed in Chapter 1, but with fun parts added. I will include some of the language features we discovered throughout this chapter.
Load the Chapter 2 (Before) Code project, either through the New Project templates or by accessing the project directly from the installation directory. To see the code in its final form, load Chapter 2 (After) Code instead.
Each chapter's sample code includes a "Before" and "After" version. The "After" version represents the code as it will look when all the changes in that chapter's "Project" section have been applied. The "Before" version doesn't have any of the chapter's project changes included, just placeholders where you will insert the code, one block at a time.
Like the project in Chapter 1, this chapter's project includes a basic Windows form with a single button on it. Clicking on the button displays the same "Hello, World!" message. However, this time, the ...