Wednesday, 21 August 2013

CHAPTER 1

Troubleshooting 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 2010 files into an older version of the Visual Basic software. (Earlier versions of Visual Basic can’t open the Visual Basic 2010 projects included on the companion CD.) 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. You’ll learn more about these options at the end of the chapter.

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 2010 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 10 in them, an indication of their version number. (Visual Basic 2010 is referred to as VB 10 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. 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 2010 offers a new file format for its projects and solutions, but the basic terminology that you might have learned while using Visual Basic 2005 or 2008 still applies.

Tuesday, 16 July 2013

Chapter 1
Exploring the Visual Studio
Integrated Development
Environment

After completing this chapter, you will be able to:
  • Use the Visual Studio Integrated Development Environment.
  • Open and run a Visual Basic program.
  • Change property settings.
  • Move, resize, dock, and automatically hide tool windows.
  • Use the IDE Navigator.
  • Open a Web browser within Visual Studio.
  • Get Help and manage Help settings.
  • Customize IDE settings to match this book’s step-by-step instructions.
Are you ready to start working with Microsoft Visual Studio 2010? This chapter gives you the skills you need to get up and running with the Visual Studio 2010 Integrated Development Environment (IDE)—the place where you will write Microsoft Visual Basic programs.
You should read this chapter whether you are new to Visual Basic programming or you have used previous versions of Visual Basic or Visual Studio.
In this chapter, you’ll learn the essential Visual Studio menu commands and programming procedures. You’ll open and run a simple Visual Basic program named Music Trivia; 
you’ll change a programming setting called a property; and you’ll practice moving, sizing, docking, and hiding tool windows. You’ll also learn how to switch between files and tools with the IDE Navigator, open a Web browser within Visual Studio, get more information by using the online Help documentation, and customize the IDE to match this book’s step-by-step instructions. These are common tasks that you’ll use in most Visual Studio programming
sessions, and they will soon become second nature to you (if they are not already)

The Visual Studio Development Environment
First, a quick note to readers upgrading from Visual Studio 2008: Although there have been lots of internal improvements to Visual Studio 2010, the Visual Studio 2010 IDE is largely the same IDE that you worked with in Visual Studio 2008. But because you may be new to Visual Studio, I’m going to explain the basics in this chapter. Also, if you’re new to Visual Studio, something else that you should know is that although the programming language you’ll be learning in this book is Visual Basic, most of the features in the Visual Studio IDE apply equally to Visual Basic, Microsoft Visual C++, and Microsoft Visual C#. All of these programs
(or more properly, compiler technologies) are available to you in the same IDE, which you can experiment with now by starting Visual Studio and looking at the product.

Start Visual Studio 2010
  1. On the Windows taskbar, click Start, click All Programs, and then click the Microsoft Visual Studio 2010 folder.The folders and icons in the Microsoft Visual Studio 2010 folder appear in a list.
  2. Click the Microsoft Visual Studio 2010 icon.
Tip If you are using Visual Basic 2010 Express, click the Microsoft Visual Basic 2010
Express icon.

 
If this is the first time you are starting Visual Studio, the program will take a few moments to configure the environment. If you are prompted to identify your programming preferences at this time, select Visual Basic development settings.
When Visual Studio starts, you see the development environment on the screen with its many menus, tools, and component windows, as shown here. (These windows are sometimes called tool windows.) You also should see a Start Page containing a set of tabs with links, guidance and learning resources, news, and project options. The Start Page is a comprehensive source of information about your project, as well as resources
Part I
Getting Started with Microsoft Visual Basic 2010

In Part I, you’ll receive an overview of essential Microsoft Visual Basic 2010 programming techniques and an introduction to the tools and features that you will work with during most Visual Basic programming sessions. You’ll learn to use the Visual Studio 2010 Integrated Development Environment (IDE), with its fulsome collection of programming tools, windows, and menu commands, and you’ll receive step-by-step instruction on how to build and run several interesting programs from scratch. This is the place to start if you’re new to Visual Basic programming or upgrading from an earlier version.
Chapter 2 introduces how controls, forms, properties, and program code can be used in combination to create an entertaining Lucky Seven slot machine game. 
Chapter 3 provides an overview of the most useful Toolbox controls, which help you present information
or program choices to the user, gather input, work with dates and times, and connect to the Web. 
Chapter 4 focuses on adding menus, toolbars, and dialog boxes to Visual Basic programs that will give your program the flair of a commercial Windows application.
Introduction
Microsoft Visual Basic 2010 is an important upgrade and enhancement of the popular Visual Basic programming language and compiler, a technology that enjoys an installed base of millions of programmers worldwide. Visual Basic 2010 is not a stand-alone product but a key component of Microsoft Visual Studio 2010—a comprehensive development system that allows you to create powerful applications for Windows, the Web, handheld devices, and a host of other environments. Whether you purchase one of the commercial editions of  Visual Studio 2010 (described later in this Introduction) or you download Visual Basic 2010 Express for a free test-drive of the software, you are in for an exciting experience. The latest features of Visual Basic will increase your productivity and programming prowess, especially if you enjoy using and integrating information from databases, entertainment media, Web pages, and Web sites. In addition, an important benefit of learning Visual Basic and the Visual Studio Integrated Development Environment (IDE) is that you can use many of the same tools to write programs for Microsoft Visual C++ 2010, Microsoft Visual C# 2010, Microsoft Visual Web Developer 2010, and other popular products.
Microsoft Visual Basic 2010 Step by Step is a comprehensive introduction to Visual Basic programming using the Visual Basic 2010 software. I’ve designed this practical, hands-on tutorial with a variety of skill levels in mind and by following the premise that programmers learn by doing. In my opinion, the best way to master a complex technology like Visual Basic is to learn essential programming techniques through carefully prepared tutorials that can be completed on your own schedule and at your own pace. And although I have significant experience with college teaching and corporate project management, this book is not a dry textbook or an “A to Z” programmer’s reference. Instead, it is a practical hands-on programming tutorial that puts you in charge of your learning, developmental milestones, and achievements. By using this book, programmers who are new to this topic will learn Visual Basic software development fundamentals in the context of useful, real-world applications; and experienced Visual Basic programmers can quickly master the essential tools and techniques offered in the Visual Basic 2010 upgrade.
Complementing this comprehensive approach is the book’s structure—4 topically organized parts, 20 chapters, and 56 step-by-step exercises and sample programs. By using this book, you’ll quickly learn how to create professional-quality Visual Basic 2010 applications for the Windows operating system and a variety of Web browsers. You’ll also have fun!