Microsoft Visual Basic 2010 Step by Step [NOOK Book]


Your hands-on, step-by-step guide to learning Visual Basic 2010.

Teach yourself the essential tools and techniques for Visual Basic 2010-one step at a time. No matter what your skill level, you'll find ...

See more details below
Microsoft Visual Basic 2010 Step by Step

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK 7.0
  • Samsung Galaxy Tab 4 NOOK 10.1
  • NOOK HD Tablet
  • NOOK HD+ Tablet
  • NOOK eReaders
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$19.99 price
(Save 44%)$35.99 List Price


Your hands-on, step-by-step guide to learning Visual Basic 2010.

Teach yourself the essential tools and techniques for Visual Basic 2010-one step at a time. No matter what your skill level, you'll find the practical guidance and examples you need to start building professional applications for Windows and the Web.

Discover how to:

  • Work in the Microsoft Visual Studio 2010 Integrated Development Environment (IDE)
  • Master essential techniques-from managing data and variables to using inheritance and dialog boxes
  • Create professional-looking Uis; add visual effects and print support
  • Build compelling Web features with the Visual Web Developer tool
  • Use Microsoft ADO.NET and advanced data presentation controls
  • Debug your programs and handle run-time errors
  • Use new features, such as Query Builder, and Microsoft .NET Framework

For customers who purchase an ebook version of this title, instructions for downloading the CD files can be found in the ebook.

Read More Show Less

Product Details

  • ISBN-13: 9780735646452
  • Publisher: Pearson Education
  • Publication date: 5/26/2010
  • Series: Step by Step Developer
  • Sold by: Barnes & Noble
  • Format: eBook
  • Edition number: 1
  • Pages: 608
  • Sales rank: 716,518
  • File size: 12 MB
  • Note: This product may take a few minutes to download.

Meet the Author

Michael Halvorson has written more than 30 books, including the popular Microsoft Visual Basic 2008 Step by Step, Microsoft Office XP Inside Out, and Microsoft Visual Basic 6.0 Professional Step by Step. A former Visual Basic localization manager at Microsoft, Michael is a professor at Pacific Lutheran University.

Read More Show Less

Table of Contents



Part I Getting Started with Microsoft Visual Basic 2010

1 Exploring the Visual Studio Integrated Development Environment 3

The Visual Studio Development Environment 4

The Visual Studio Tools 7

The Designer 10

Running a Visual Basic Program 11

The Properties Window 13

Moving and Resizing the Programming Tools 17

Moving and Resizing Tool Windows 18

Docking Tool Windows 19

Hiding Tool Windows 21

Switching Among Open Files and Tools by Using the IDE Navigator 22

Opening a Web Browser Within Visual Studio 23

Getting Help 24

Managing Help Settings 25

Using F1 Help 26

Customizing IDE Settings to Match Step-by-Step Exercises 29

Setting the IDE for Visual Basic Development 29

Checking Project and Compiler Settings 31

One Step Further: Exiting Visual Studio 33

Chapter 1 Quick Reference 34

2 Writing Your First Program 37

Lucky Seven: Your First Visual Basic Program 37

Programming Steps 38

Creating the User Interface 38

Setting the Properties 45

The Picture Box Properties 49

Writing the Code 52

A Look at the Button1_Click Procedure 56

Running Visual Basic Applications 58

Sample Projects on Disk 59

Building an Executable File 60

Deploying Your Application 62

One Step Further: Adding to a Program 63

Chapter 2 Quick Reference 64

3 Working with Toolbox Controls 67

The Basic Use of Controls: The Hello World Program 67

Using the DateTimePicker Control 73

The Birthday Program 73

Controls for Gathering Input 78

Using Group Boxes and Radio Buttons 81

Processing Input with List Boxes 84

A Word About Terminology 89

One Step Further: Using the LinkLabel Control 91

Chapter 3 Quick Reference 95

4 Working with Menus, Toolbars, and Dialog Boxes 97

Adding Menus by Using the MenuStrip Control 97

Adding Access Keys to Menu Commands 99

Processing Menu Choices 102

Adding Toolbars with the ToolStrip Control 107

Using Dialog Box Controls 110

Event Procedures That Manage Common Dialog Boxes 112

One Step Further: Assigning Shortcut Keys to Menus 117

Chapter 4 Quick Reference 119

Part II Programming Fundamentals

5 Visual Basic Variables and Formulas, and the .NET Framework 123

The Anatomy of a Visual Basic Program Statement 123

Using Variables to Store Information 124

Setting Aside Space for Variables: The Dim Statement 124

Implicit Variable Declaration 126

Using Variables in a Program 127

Using a Variable to Store Input 130

Using a Variable for Output 133

Working with Specific Data Types 135

Constants: Variables That Don't Change 142

Working with Visual Basic Operators 143

Basic Math: The +,-, and / Operators 144

Using Advanced Operators: \, Mod, , and & 147

Working with Math Methods in the .NET Framework 152

One Step Further: Establishing Order of Precedence 155

Using Parentheses in a Formula 156

Chapter 5 Quick Reference 156

6 Using Decision Structures 159

Event-Driven Programming 159

Using Conditional Expressions 161

If...Then Decision Structures 161

Testing Several Conditions in an If...Then Decision Structure 162

Using Logical Operators in Conditional Expressions 167

Short-Circuiting by Using AndAlso and OrElse 169

Select Case Decision Structures 171

Using Comparison Operators with a Select Case Structure 173

One Step Further: Detecting Mouse Events 177

Chapter 6 Quick Reference 179

7 Using Loops and Timers 181

Writing For...Next Loops 181

Using a Counter Variable in a Multiline TextBox Control 183

Creating Complex For...Next Loops 185

Using a Counter That Has Greater Scope 189

Writing Do Loops 192

Avoiding an Endless Loop 193

The Timer Control 196

Creating a Digital Clock by Using a Timer Control 197

Using a Timer Object to Set a Time Limit 200

One Step Further: Inserting Code Snippets 203

Chapter 7 Quick Reference 207

8 Debugging Visual Basic Programs 209

Finding and Correcting Errors 209

Three Types of Errors 210

Identifying Logic Errors 211

Debugging 101: Using Debugging Mode 212

Tracking Variables by Using a Watch Window 217

Visualizers: Debugging Tools That Display Data 220

Using the Immediate and Command Windows 221

Switching to the Command Window 223

One Step Further: Removing Breakpoints 224

Chapter 8 Quick Reference 225

9 Trapping Errors by Using Structured Error Handling 227

Processing Errors by Using the Try...Catch Statement 227

When to Use Error Handlers 228

Setting the Trap: The Try...Catch Code Block 229

Path and Disc Drive Errors 229

Writing a Disc Drive Error Handler 233

Using the Finally Clause to Perform Cleanup Tasks 234

More Complex Try...Catch Error Handlers 236

The Exception Object 236

Specifying a Retry Period 239

Using Nested Try...Catch Blocks 242

Comparing Error Handlers with Defensive Programming Techniques 242

One Step Further: The Exit Try Statement 243

Chapter 9 Quick Reference 244

10 Creating Modules and Procedures 247

Working with Modules 247

Creating a Module 248

Working with Public Variables 251

Creating Procedures 255

Writing Function Procedures 256

Function Syntax 257

Calling a Function Procedure 258

Using a Function to Perform a Calculation 258

Writing Sub Procedures 262

Sub Procedure Syntax 262

Calling a Sub Procedure 263

Using a Sub Procedure to Manage Input 264

One Step Further: Passing Arguments by Value and by Reference 268

Chapter 10 Quick Reference 270

11 Using Arrays to Manage Numeric and String Data 273

Working with Arrays of Variables 273

Creating an Array 274

Declaring a Fixed-Size Array 275

Setting Aside Memory 276

Working with Array Elements 277

Declaring an Array and Assigning It Initial Values 278

Creating a Fixed-Size Array to Hold Temperatures 279

Creating a Dynamic Array 283

Preserving Array Contents by Using ReDim Preserve 287

Using ReDim for Three-Dimensional Arrays 288

One Step Further: Processing Large Arrays by Using Methods in the Array Class 288

The Array Class 288

Chapter 11 Quick Reference 295

12 Working with Collections 297

Working with Object Collections 297

Referencing Objects in a Collection 298

Writing For Each...Next Loops 298

Experimenting with Objects in the Controls Collection 299

Using the Name Property in a For Each...Next Loop 302

Creating Your Own Collections 304

Declaring New Collections 304

One Step Further: VBA Collections 309

Entering the Word Macro 310

Chapter 12 Quick Reference 311

13 Exploring Text Files and String Processing 313

Reading Text Files 313

The My Namespace 314

The StreamReader Class 316

Using the ReadAllText Method 317

Writing Text Files 321

The WriteAllText Method 321

The StreamWriter Class 322

Using the WriteAllText Method 323

Processing Strings with the String Class 326

Sorting Text 329

Working with ASCII Codes 330

Sorting Strings in a Text Box 331

Examining the Sort Text Program Code 334

Protecting Text with Basic Encryption 336

One Step Further: Using the Xor Operator 340

Examining the Encryption Program Code 342

Chapter 13 Quick Reference 345

Part III Designing the User Interface

14 Managing Windows Forms and Controls at Run Time 351

Adding New Forms to a Program 351

How Forms Are Used 352

Working with Multiple Forms 352

Using the DialogResult Property in the Calling Form 358

Positioning Forms on the Windows Desktop 359

Minimizing, Maximizing, and Restoring Windows 364

Adding Controls to a Form at Run Time 364

Organizing Controls on a Form 367

One Step Further: Specifying the Startup Object 371

Chapter 14 Quick Reference 373

15 Adding Graphics and Animation Effects 375

Adding Artwork by Using the System Drawing Namespace 376

Using a Form's Coordinate System 376

The System.Drawing. Graphics Class 376

Using the Form's Paint Event 378

Adding Animation to Your Programs 380

Moving Objects on the Form 380

The Location Property 381

Creating Animation by Using a Timer Object 382

Expanding and Shrinking Objects While a Program is Running 386

One Step Further: Changing Form Transparency 388

Chapter 15 Quick Reference 390

16 Inheriting Forms and Creating Base Classes 393

Inheriting a Form by Using the Inheritance Picker 393

Creating Your Own Base Classes 399

Adding a New Class to Your Project 401

One Step Further: Inheriting a Base Class 408

Chapter 16 Quick Reference 412

17 Working with Printers 415

Using the PrintDocument Class 415

Printing Text from a Text Box Object 420

Printing Multipage Text Files 424

One Step Further: Adding Print Preview and Page Setup Dialog Boxes 430

Chapter 17 Quick Reference 437

Part IV Database and Web Programming

18 Getting Started with ADO.NET 441

Database Programming with ADO.NET 441

Database Terminology 442

Working with an Access Database 444

The Data Sources Window 452

Using Bound Controls to Display Database Information 458

One Step Further: SQL Statements, LINQ, and Filtering Data 461

Chapter 18 Quick Reference 466

19 Data Presentation Using the DataGridView Control 467

Using DataGridView to Display Database Records 467

Formatting DataGridView Cells 479

Adding a Second Data Grid View Object 482

One Step Further: Updating the Original Database 485

Chapter 19 Quick Reference 488

20 Creating Web Sites and Web Pages by Using Visual Web Developer and ASP.NET 491

Inside ASP.NET 491

Web Pages vs. Windows Forms 493

Server Controls 493

HTML Controls 494

Building a Web Site by Using Visual Web Developer 495

Considering Software Requirements for ASP.NET Programming 495

Using the Web Page Designer 498

Adding Server Controls to a Web Site 501

Writing Event Procedures for Web Page Controls 504

Customizing the Web Site Template 509

Displaying Database Records on a Web Page 512

One Step Further: Setting Web Site Titles in Internet Explorer 519

Chapter 20 Quick Reference 522

Appendix: Where to Go for More Information 523

Index 529

Read More Show Less

Customer Reviews

Average Rating 4.5
( 6 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 6 Customer Reviews
  • Anonymous

    Posted May 21, 2011

    No text was provided for this review.

  • Anonymous

    Posted March 26, 2011

    No text was provided for this review.

  • Anonymous

    Posted February 18, 2012

    No text was provided for this review.

  • Anonymous

    Posted November 7, 2012

    No text was provided for this review.

  • Anonymous

    Posted August 29, 2010

    No text was provided for this review.

  • Anonymous

    Posted May 26, 2012

    No text was provided for this review.

Sort by: Showing all of 6 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)