The Visual Studio Development Environment
Although the programming language you'll be learning in this book is Visual Basic, the development environment you'll be using to write programs is called the Microsoft Visual Studio Integrated Development Environment, or IDE for short. Visual Studio is a powerful and customizable programming workshop that contains all the tools you need to build robust programs for Windows and the Web quickly and efficiently. Most of the features in the Visual Studio IDE apply equally to Visual Basic, Visual C++, Visual C#, and Visual J#. Use the following procedures to start Visual Studio now.
If you haven't yet installed this book's practice files, work through “Finding Your Best Starting Point” and “About the CD-ROM and Practice Files” in this book's Introduction. (I recommend that you place the project files and related subfolders in the c:\vb05sbs folder.) Then return to this chapter.
Start Visual Studio 2005
On the Windows taskbar, click Start, point to All Programs, and then point to the Microsoft Visual Studio 2005 folder.
The folders and icons in the Microsoft Visual Studio 2005 folder appear in a list.
To perform the steps in this book, you must have a version of the Microsoft Visual Studio 2005 software installed. Most of the procedures that I describe are designed to work with either Visual Studio 2005 Standard Edition or Visual Studio 2005 Professional Edition. If you are especially lucky, you might have access to Visual Studio 2005 Team Suite or Visual Studio 2005 Team Foundation tools as well. If this is the case, you'll be able to follow the procedures in this book without difficulty, but you will also have access to some cool advanced features and capabilities. However, even though it is tempting, don't try to use this book if you have an earlier version of the Visual Basic software. If that's your situation, you'll be better served by locating an earlier (and perhaps lower priced!) edition of my book, such as Microsoft Visual Basic .NET Step by Step Version 2003 (which describes the Visual Basic .NET 2003 software) or Microsoft Visual Basic Professional 6.0 Step by Step (which describes the Visual Basic 6 software).
Click the Microsoft Visual Studio 2005 icon.
Visual Studio starts, and you see the development environment on the screen with its many menus, tools, and component windows. (These windows are sometimes called tool windows.) You also should see a Start Page containing a set of links, MSDN articles, and project options. In Visual Studio 2005, the Start Page is much improved and has become a comprehensive source of information about your project, as well as resources within the Visual Basic development community. The new Community menu on the Visual Studio menu bar provides access to many of the same resources.
The first thing most developers do when they start Visual Studio is open an existing project—either a completed solution they want to work with again or an ongoing development project. Try opening an existing project that I created for you—the Music Trivia program.
Open a Visual Basic project
Click the Open Projects/Solutions link in the Start Page.
The Open Project dialog box appears on the screen with several options. (You can also display this dialog box by clicking the Open Project command on the File menu or by pressing Ctrl+O.) Even if you haven't used Visual Studio before, the Open Project dialog box will seem straightforward because it resembles the familiar Open dialog box in Microsoft Word or Microsoft Excel.
In the Open Project dialog box, you see a number of shortcut icons along the left side of the window. The My Projects icon is particularly useful; it opens the Projects folder inside the My Documents\Visual Studio 2005 folder on your system. By default, Visual Studio saves your projects in this Projects folder, giving each project its own subfolder. The folder VSMacros80 contains the macro files for Visual Studio 2005 (which is also called Visual Studio version 8.0 in some parts of the software).
Browse to the c:\vb05sbs folder on your hard disk.
The c:\vb05sbs folder is the default location for this book's extensive sample file collection, and you'll find the files there if you followed the setup instructions in “About the CD-ROM and Practice Files” at the beginning of this book. If you didn't install the sample files, close this dialog box and install them now by using the CD-ROM included with this book. Then return to this procedure and continue.
Open the chap01\musictrivia folder, and then double-click the MusicTrivia solution file. (If your system shows file name extensions, this file will end with .sln.)
Visual Studio loads the MusicTrivia form, properties, and program code for the MusicTrivia solution. The Start Page probably is still visible, but in the upper-right corner of the screen, Solution Explorer lists some of the files in the solution.
If you see an error message indicating that the project you want to open is in a newer file format, you might be trying to load Visual Basic 2005 files into the older Visual Basic .NET 2002 or 2003 software. (Earlier versions of Visual Basic cannot open the Visual Basic 2005 projects included on the companion CD-ROM.) To check which version of Visual Basic you're using, click the About command on the Help menu.
Visual Studio provides a special check box named Always Show Solution to control several options related to solutions within the IDE. The check box is located on the Projects and Solutions/General tab of the Options dialog box, which you open by clicking the Options command on the Tools menu. If the check box is selected, a subfolder is created for each new solution, placing the project and its files in a separate folder beneath the solution. Also, if you select the Always Show Solution check box, a few options related to solutions appear in the IDE, such as commands on the File menu and a solution entry in Solution Explorer. If you like the idea of creating separate folders for solutions and seeing solution-related commands and settings, select this check box.
Projects and Solutions
In Visual Studio, programs under development are typically called projects or solutions because they contain many individual components, not just one file. Visual Basic 2005 programs include a project file (.vbproj) and a solution file (.sln), and if you examine these files within a file browsing utility such as Windows Explorer, you'll notice that the solution file icons have a tiny 8 in them, an indication of their version number. (Visual Basic 2005 is referred to as VB 8 internally.)
A project file contains information specific to a single programming task. A solution file contains information about one or more projects. Solution files are useful to manage multiple related projects and are similar to project group files (.vbg) in Visual Basic 6. The samples included with this book typically have a single project for each solution, so opening the project file (.vbproj) has the same effect as opening the solution file (.sln). But for a multi-project solution, you will want to open the solution file. Visual Basic 2005 offers a new file format for its projects and solutions, but the basic terminology that you might have learned while using Visual Basic .NET 2002 or 2003 still applies.