Previous Page
Next Page

Beginning Programming with the Visual Studio 2005 Environment

Visual Studio 2005 is a tool-rich programming environment containing all the functionality you'll need to create large or small C# projects. You can even create projects that seamlessly combine modules from different languages. In the first exercise, you'll start the Visual Studio 2005 programming environment and learn how to create a console application.

Create a console application in Visual Studio 2005
  1. In Microsoft Windows, click the Start button, point to All Programs, and then point to Microsoft Visual Studio 2005.

  2. Click the Microsoft Visual Studio 2005 icon. Visual Studio 2005 starts.

    NOTE
    If this is the first time that you have run Visual Studio 2005, you might see a dialog box prompting you to choose your default development environment settings. Visual Studio 2005 can tailor itself according your preferred development language. The various dialog boxes and tools in the integrated development environment (IDE) will have their default selections set for the language you choose. Select Visual C# Development Settings from the list, and then click the Start Visual Studio button. After a short delay, the Visual Studio 2005 IDE appears.
    Graphic
  3. On the File menu, point to New, and then click Project. The New Project dialog box opens. This dialog box allows you to create a new project using various templates, such as Windows Application, Class Library, and Console Application, that specify the type of application you want to create.

    NOTE
    The actual templates available depend on the version of Visual Studio 2005 you are using. It is also possible to define new project templates, but that is beyond the scope of this book.
    Graphic
  4. In the Templates pane, click the Console Application icon.

  5. In the Location field, type C:\Documents and Settings\YourName\My Documents\Microsoft Press\Visual CSharp Step by Step\Chapter 1.

    Replace the text YourName in this path with your Windows user name. To save a bit of space throughout the rest of this book, we will simply refer to the path “C:\Documents and Settings\YourName\My Documents” as your “\My Documents” folder.

    NOTE
    If the folder you specify does not exist, Visual Studio 2005 creates it for you.
  6. In the Name field, type TextHello.

  7. Ensure that the Create Directory for Solution check box is checked and then click OK. The new project opens.

The menu bar at the top of the screen provides access to the features you'll use in the programming environment. You can use the keyboard or the mouse to access the menus and commands exactly as you can in all Windows-based programs. The toolbar is located beneath the menu bar and provides button shortcuts to run the most frequently used commands. The Code and Text Editor window occupying the main part of the IDE displays the contents of source files. In a multi-file project, each source file has its own tab labeled with the name of the source file. You can click the tab once to bring the named source file to the foreground in the Code and Text Editor window. The Solution Explorer displays the names of the files associated with the project, among other items. You can also double-click a file name in the Solution Explorer to bring that source file to the foreground in the Code and Text Editor window.

Graphic

Before writing the code, examine the files listed in the Solution Explorer, which Visual Studio 2005 has created as part of your project:


Previous Page
Next Page