C# 24-Hour Trainer. Stephens Rod

Чтение книги онлайн.

Читать онлайн книгу C# 24-Hour Trainer - Stephens Rod страница 4

C# 24-Hour Trainer - Stephens Rod

Скачать книгу

the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.

      p2p.wrox.com

      For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

      At http://p2p.wrox.com you will find a number of different forums that will help you not only as you read this book but also as you develop your own applications. To join the forums, just follow these steps:

      1. Go to p2p.wrox.com and click on the Register link.

      2. Read the terms of use and click Agree.

      3. Complete the required information to join, as well as any optional information you wish to provide, and click Submit.

      4. You will receive an e-mail with information describing how to verify your account and complete the joining process.

      NOTE

      You can read messages in the forums without joining P2P, but to post your own messages, you must join.

      Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the web. If you would like to have new messages from a particular forum e-mailed to you, click on the “Subscribe to this Forum” icon by the forum name in the forum listing.

      For more information about how to use Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works, as well as many common questions specific to P2P and Wrox books. To read the FAQs, click on the FAQ link on any P2P page.

      Using the P2P forums allows other readers to benefit from your questions and any answers they generate. I monitor my book's forums and respond whenever I can help.

      If you have other comments, suggestions, or questions that you don't want to post in the forums, feel free to e-mail me at [email protected]. I can't promise to solve every problem but I'll try to help you out if I can.

      Section I

      The Visual Studio IDE and Controls

      The lessons in this section of the book explain how to use the Visual Studio integrated development environment (IDE). They explain how to use the IDE to create forms, place controls on the forms, and set control properties. These lessons describe some of C#'s most useful controls and give you practice using them.

      You can do practically all of this in the IDE without writing a single line of code! That makes C# a great environment for rapid prototyping. You can build a form, add controls, and run the program to see what it looks like without ever creating a variable, declaring a method, or getting stuck in an infinite loop.

      The lessons in this section explain how to get that far. A few of these lessons show how to add a line or two of code to make a form more interesting, but for now the focus is on using the IDE to build forms and controls. Writing code (and fixing the inevitable bugs) comes later.

Lesson 1

      Getting Started with the Visual Studio IDE

      The Visual Studio integrated development environment (IDE) plays a central role in C# development. In this lesson you explore the IDE. You learn how to configure it for C# development, and you learn about some of the more useful of the IDE's windows and what they do. When you finish this lesson, you'll know how to create a new project. It may not do much, but it will run and will prepare you for the lessons that follow.

      Visual C#

      Visual Studio is a development environment that you can use with several programming languages including Visual C#, Visual Basic, Visual C++, and F#. All of those are high-level programming languages that you can use to perform complex calculations, organize your Pokémon cards, draw pretty fractals (see en.wikipedia.org/wiki/Fractal and mathworld.wolfram.com/Fractal.html), play games, download cat pictures from the Internet, and do everything else you would expect from a program.

      They can also contain bugs that delete files accidentally, discard an hour's worth of typing without warning, balance your checkbook incorrectly, and cause all sorts of other problems. Programming languages can help you do things, but they can't force you to do the right things. That's up to you.

      Visual C# combines C# with the Visual Studio development environment. You can use a text editor to write C# programs without Visual Studio, but it's a lot of work. You don't get all of the nice features that Visual Studio provides, such as special code editing features, drag-and-drop control creation, and a debugger. In short, it's a lot less fun, so I won't cover that kind of programming in this book.

      Visual C# and C# go together like hockey and fistfights: if you mention one, most people assume you're also talking about the other. Most people simply say C#, so this book does, too, unless there's a reason to distinguish between C# and Visual C#.

      The .NET Framework also plays an important role in C# programs. It includes classes that make performing certain tasks easier, runtime tools that make it possible to execute C# programs, and other plumbing necessary to build and run C# programs.

      Normally you don't need to worry about whether a feature is provided by Visual Studio, the C# language, or the .NET Framework. They all go together, so for the purposes of this book at least you can ignore the difference.

      Installing C#

      Before you can use C# to write the next blockbuster first-person Xbox game, you need to install it. So if you haven't done so already, install C#.

      You can install one of the free Express Editions at www.microsoft.com/express/Windows. As I write this, that page lists versions of Visual Studio 2015, but when you visit that page it should let you install the latest version. (I'm using a preview build of Visual Studio 2015 to write the programs that go with this book.)

      Several versions are available on that page, so be sure you pick the right one. Here's a quick summary of some of the versions that may be available:

      ● Community– This version lets you build web, Windows Store (including tablet and phone apps), Windows Desktop, Android, and iOS applications. This is probably the best version for you to download.

      ● Express for Web– This version focuses on building websites.

      ● Express for Windows– This version focuses on building Windows Phone and Windows Store apps.

      ● Express for Windows Desktop– This version focuses on desktop applications. You run these from the Windows desktop, not the start screen.

      ● Team Foundation Server Express– This

Скачать книгу