System Requirements

System Requirements

You'll need the following hardware and software to complete the exercises in this book:

  • Microsoft Windows XP Professional Edition with Service Pack 2 or Microsoft Windows XP Home Edition with Service Pack 2, Microsoft Windows Server 2003 with Service Pack 1, or Microsoft Windows 2000 with Service Pack 4 (Microsoft Windows 2000 Datacenter Server is not supported)

  • Microsoft Visual Studio 2005 Standard Edition or Microsoft Visual Studio 2005 Professional Edition

  • 600 MHz Pentium or compatible processor (1 GHz Pentium recommended)

  • 192 MB RAM (256 MB or more recommended)

  • Video (800 x 600 or higher resolution) monitor with at least 256 colors (1024 x 768 High Color 16-bit recommended)

  • CD-ROM or DVD-ROM drive

  • Microsoft Mouse or compatible pointing device

This book and the practice files were tested using Visual Studio 2005 Standard and Visual Studio 2005 Professional. You might notice a few differences if you're using other editions of Visual Studio 2005. In particular, if you're using Visual Studio 2005 Express Edition, a few features will be unavailable to you.

Prerelease Software

This book was reviewed and tested against the August 2005 Community Technical Preview (CTP) of Visual Studio 2005. The August CTP was the last preview before the final release of Visual Studio 2005. This book is expected to be fully compatible with the final release of Visual Studio 2005 and Visual Basic 2005. If there are any changes or corrections for this book, they will be collected and added to an easy-to-access Microsoft Knowledge Base article on the Web. See the “Support for This Book” section for more information.

Installing and Using the Practice Files

The CD-ROM inside this book contains the practice files that you'll use as you perform the exercises in the book. For example, when you're learning how to display database tables on a form by using the GridDataView control, you'll open one of the practice files—an academic database named Students.mdb—and then use Visual Studio database programming tools to access the database. By using the practice files, you won't waste time creating files that aren't relevant to the exercise. Instead, you can concentrate on learning how to master Visual Basic 2005 programming techniques. With the files and the step-by-step instructions in the chapters, you'll also learn by doing, which is an easy and effective way to acquire and remember new skills.

Before you break the seal on the CD-ROM, be sure that this book matches your version of the software. This book is designed for use with Visual Studio 2005 and the Visual Basic 2005 programming language. To find out what software you're running, you can check the product package, or you can start the software, open a project, and then click About Microsoft Visual Studio on the Help menu at the top of the screen.

Installing the Practice Files

Installing the practice files on your hard disk requires approximately 7.2 MB of disk space. Follow these steps to install the practice files on your computer's hard disk so that you can use them with the exercises in this book.

  1. Remove the CD from the package inside this book, and insert it into your CD-ROM drive.

    An end user license agreement should open automatically. If this agreement does not appear, open My Computer on the desktop or Start menu, double-click the icon for your CD-ROM drive, and then double-click StartCD.exe.

  2. Review the end user license agreement. If you accept the terms, select the accept option, and then click Next.

    A menu appears with options related to the book.

  3. Click Install Practice Files.

  4. Follow the onscreen instructions.

    For best results when using the practice files with this book, accept the preselected installation location, which by default is c:\vb05sbs. If you change the installation location, you'll need to manually adjust the paths in several practice files to locate essential components, such as artwork and database files, when you use them.

  5. When the files have been installed, remove the CD-ROM from your drive and replace it in the package inside the back cover of your book.

    If you accepted the default settings, a folder named c:\vb05sbs has been created on your hard disk, and the practice files have been placed in that folder. You'll find one folder in c:\vb05sbs for each chapter in the book. (Some of the files represent completed projects, and others will require that you enter some program code.) If you have trouble running any of the practice files, refer to the text in the book that describes those files.

Using the Practice Files

Each chapter in this book explains when and how to use the practice files for that chapter. When it's time to use a practice file, the book lists instructions for how to open the file. The chapters are built around scenarios that simulate real programming projects so that you can easily apply the skills you learn to your own work.

Visual Basic 2005 features a new file format for its projects and solutions. Accordingly, you won't be able to open the practice files for this book if you're using an older version of the Visual Basic or Visual Studio software. To see what version of Visual Basic or Visual Studio you're using, click the About command on the Help menu.

Visual Studio is extremely customizable and can be configured to open and save projects and solutions in different ways. The instructions in this book generally rely on the default setting for Visual Studio. For more information about how settings within the development environment affect how you write programs and use the practice files, see the section “Customizing IDE Settings to Match Step by Step Exercises” in Chapter 1, “Exploring the Visual Studio Integrated Development Environment.”

For those of you who like to know all the details, here's a list of the Visual Basic projects included on the CD-ROM. Each project is located in its own folder and has several support files. Look at all the things you will be doing!



Chapter 1


A simple trivia program that welcomes you to the programming course and displays a digital photo.

Chapter 2


Your first program—a game that simulates a Las Vegas Lucky Seven slot machine.

Chapter 3


A program that uses the DateTimePicker control to pick a date.


A program that demonstrates the CheckBox control and its properties.


A “Hello, world!” program that demonstrates the Label and TextBox controls.

Input Controls

The user interface for a graphical ordering environment, assembled using several powerful input controls.


A demonstration of the LinkLabel control that opens a Web browser in your Visual Basic application.

Chapter 4


Demonstrates how to use Visual Studio dialog box controls, toolbars, and menus.

Chapter 5

Advanced Math

Advanced use of operators for integer division, remainder division, exponentiation, and string concatenation.

Basic Math

Basic use of operators for addition, subtraction, multiplication, and division.

Constant Tester

Uses a constant to hold a fixed mathematical entity.

Data Types

A demonstration of Visual Basic fundamental data types and their use with variables.

Framework Math

Demonstrates the .NET Framework classes with mathematical methods.

Input Box

Receives input with the InputBox function.

Variable Test

Declares and uses variables to store information.

Chapter 6

Select Case

Uses a Select Case decision structure and a ListBox control to display a welcome message in several languages.

User Validation

Uses the If…Then…Else decision structure and a MaskedTextBox control to manage a logon process.

Chapter 7

Celsius Conversion

Converts temperatures from Fahrenheit to Celsius by using a Do loop.

Digital Clock

A simple digital clock program that demonstrates the Timer control.

For Loop

Demonstrates using a For...Next loop to display text in a TextBox control, and using the Chr function to create a Wrap character.

For Loop Icons

Uses a global counter variable in an event procedure as an alternative to loops. This program also displays images by using a PictureBox control.

Timed Password

Demonstrates how to use a Timer control to create a logon program with a password time-out feature.

Windows Version Snippet

Shows how to use the new Insert Snippet command to display the current version of Windows running on a user's computer.

Chapter 8

Debug Test

A simulated debugging problem, designed to be solved using the Visual Studio debugging tools.

Chapter 9

Disc Drive Error

A program that crashes when a CD drive is used incorrectly. This project is used as the basis of a Visual Basic error handler.

Disc Drive Handler

A project with a completed error handler for loading files that demonstrates the Try…Catch syntax.

Chapter 10

Text Box Sub

A general-purpose Sub procedure that adds items to a list box.


A clean version of the Lucky7 slot machine project from Chapter 2, which you enhance by using public variables and a function that computes the game's win rate.

Chapter 11

Array Class Sorts

A program that shows you how to create and manipulate large integer arrays. Demonstrates the Array.Sort and Array.Reverse methods and how to use a ProgressBar control to give the user visual feedback during long sorts.

Dynamic Array

Computes the average temperature for any number of days by using a dynamic array.

Fixed Array

Computes the average weekly temperature by using a fixed-length array.

Chapter 12

Controls Collection

Uses a For Each loop and the Visual Studio Controls collection to move objects on a form.

URL Collection

Demonstrates a user-defined collection containing a list of Web addresses (URLs) recently visited by the user.

Chapter 13

Quick Note

A simple note-taking utility that demonstrates the FileOpen function and the TextBox, MenuStrip, and SaveFileDialog controls.

Sort Text

A text file editor with a menu bar that demonstrates how to manage Open, Close, Save As, Insert Date, Sort Text, and Exit commands in a program. Contains a ShellSort module for sorting arrays that can be added to other programming projects.

Text Browser

Displays the contents of a text file in a Visual Basic program. Demonstrates menu commands, a Try…Catch error handler, and the FileOpen and LineInput functions, and serves as a foundation for the other programs in this chapter.

Chapter 14

Add Controls

Demonstrates how controls are added to a Windows Form at run time by using program code (not the Designer).

Anchor and Dock

Uses the Anchor and Dock properties of a form to align objects at run time.

Desktop Bounds

Uses the StartPosition and DesktopBounds properties to position a Windows form at run time. Also demonstrates the FormBorderStyle property, Rectangle structure, and ShowDialog method.

Lucky Seven Help

The enhanced Lucky7 program (TrackWins) from Chapter 10, which is enhanced again through the addition of a second form to display Help information.

Chapter 15

Draw Shapes

Demonstrates a few of the useful graphics methods in the System.Drawing namespace, including DrawEllipse, FillRectangle, and DrawCurve.

Moving Icon

Animates an icon on the form, moving it from the top of the form to the bottom each time that you click the Move Down button.

Transparent Form

Demonstrates how to change the transparency of a form by using the Me object and the Opacity property.

Zoom In

Simulates zooming in, or magnifying, an object on a form (in this case, the planet Earth).

Chapter 16

Form Inheritance

Uses the Visual Studio Inheritance Picker to create a form that inherits its characteristics and functionality from another form.

Person Class

Demonstrates how to create new classes, properties, and methods in a Visual Basic project. The new Person class is an employee record with first name, last name, and date of birth fields, and it contains a method that computes the current age of an employee.

Chapter 17

Print Dialogs

Demonstrates how to create Print Preview and Page Setup dialog boxes.

Print File

A project that handles more sophisticated printing tasks, including printing a multipage text file with wrapping lines. Includes lots of code to use in your own projects.

Print Graphics

Prints graphics from within a Visual Basic program by using an error handler, the Print method, and the DrawImage method.

Print Text

Demonstrates how simple text is printed in a Visual Basic program.

Chapter 18

ADO Form

Demonstrates how ADO.NET is used to establish a connection to a Microsoft Access database and display information from it.

Chapter 19

DataGridView Sample

Shows how the DataGridView control is used to display multiple tables of data on a form. Also demonstrates how navigation bars, datasets, and table adapters are interconnected and bound to objects on a form.

Chapter 20


Demonstrates using Visual Web Developer and ASP.NET to create a car loan calculator that runs in a Web browser, offers Help information, and displays database records.