Skip to main content

Beginning Visual Basic 2010

Beginning Visual Basic 2010

Thearon Willis, Bryan Newsome

ISBN: 978-1-118-05727-8

Jan 2011

724 pages

$29.99

Description

Visual Basic 2010 offers a great deal of functionality in both tools and language. No one book could ever cover Visual Basic 2010 in its entirety—you would need a library of books. What this book aims to do is to get you started as quickly and easily as possible. It shows you the roadmap, so to speak, of what there is and where to go. Once we've taught you the basics of creating working applications (creating the windows and controls, how your code should handle unexpected events, what object-oriented programming is, how to use it in your applications, and so on) we’ll show you some of the areas you might want to try your hand at next.

INTRODUCTION xxix

CHAPTER 1: WELCOME TO VISUAL BASIC 2010 1

Event-Driven Programming 2

Installing Visual Basic 2010 3

The Visual Studio 2010 IDE 6

Creating a Simple Application 10

Using the Help System 20

Summary 20

CHAPTER 2: THE MICROSOFT .NET FRAMEWORK 23

Microsoft’s Reliance on Windows 23

Writing Software for Windows 27

Common Language Runtime 30

The Common Type System and Common Language Specification 33

Summary 33

CHAPTER 3: WRITING SOFTWARE 37

Information and Data 37

Working with Variables 39

Comments and Whitespace 42

Data Types 44

Storing Variables 65

Methods 70

Summary 80

CHAPTER 4: CONTROLLING THE FLOW 83

Making Decisions 83

The If Statement 84

Select Case 98

Loops 106

Summary 120

CHAPTER 5: WORKING WITH DATA STRUCTURES 123

Understanding Arrays 123

Understanding Enumerations 133

Understanding Constants 139

Structures 142

Working with ArrayLists 146

Working with Collections 153

Building Lookup Tables with Hashtable 157

Advanced Array Manipulation 164

Summary 166

CHAPTER 6: EXTENSIBLE APPLICATION MARKUP LANGUAGE (XAML) 169

What Is XAML? 170

XAML Syntax 171

Windows Presentation Foundation 174

Summary 189

CHAPTER 7: BUILDING WINDOWS APPLICATIONS 193

Responding to Events 193

Building a Simple Application 201

Counting Characters 205

Counting Words 207

Creating More Complex Applications 213

Creating the Toolbar 214

Creating the Status Bar 218

Creating an Edit Box 220

Clearing the Edit Box 222

Responding to Toolbar Buttons 224

Using Multiple Forms 230

Summary 233

CHAPTER 8: DISPLAYING DIALOG BOXES 237

The MessageBox 237

The OpenFileDialog Control 244

The SaveDialog Control 252

The FontDialog Control 257

The ColorDialog Control 260

The PrintDialog Control 263

The FolderBrowserDialog Control 271

Summary 275

CHAPTER 9: CREATING MENUS 277

Understanding Menu Features 277

Creating Menus 280

Context Menus 290

Summary 297

CHAPTER 10: DEBUGGING AND ERROR HANDLING 299

Major Error Types 300

Debugging 305

Error Handling 331

Summary 335

CHAPTER 11: BUILDING OBJECTS 339

Understanding Objects 339

Building Classes 343

Reusability 344

Designing an Object 345

Constructors 357

Inheritance 359

Objects and Structures 369

The Framework Classes 370

Summary 377

CHAPTER 12: ADVANCED OBJECT-ORIENTED TECHNIQUES 381

Building a Favorites Viewer 381

An Alternative Favorite Viewer 399

Using Shared Properties and Methods 404

Understanding Object-Oriented Programming and Memory Management 410

Summary 414

CHAPTER 13: BUILDING CLASS LIBRARIES 417

Understanding Class Libraries 418

Using Strong Names 424

Registering Assemblies 428

Designing Class Libraries 429

Using Third-Party Class Libraries 430

Viewing Classes with the Object Browser 431

Summary 432

CHAPTER 14: CREATING WINDOWS FORMS USER CONTROLS 435

Windows Forms Controls 436

Creating and Testing a User Control 436

Exposing Properties from User Controls 440

Design Time or Runtime 447

Creating a Command Link Control 449

Summary 460

CHAPTER 15: ACCESSING DATABASES 463

What Is a Database? 464

The SQL SELECT Statement 465

Queries in Access 467

Data Access Components and Controls 471

Data Binding 473

Summary 479

CHAPTER 16: DATABASE PROGRAMMING WITH SQL SERVER AND ADO.NET 483

ADO.NET 485

The ADO.NET Classes in Action 497

Data Binding 506

Summary 533

CHAPTER 17: DYNAMIC DATA WEB SITE 537

Creating a Dynamic Data Linq to SQL Web Site 537

Summary 547

CHAPTER 18: ASP.NET 549

Thin-Client Architecture 550

Web Forms versus Windows Forms 551

Web Applications: The Basic Pieces 552

Active Server Pages 553

Building Web Sites 555

Summary 579

CHAPTER 19: VISUAL BASIC 2010 AND XML 583

Understanding XML 583

The Address Book Project 587

Integrating with the Address Book Application 611

Summary 618

CHAPTER 20: DEPLOYING YOUR APPLICATION 621

What Is Deployment? 621

Creating a Visual Studio 2010 Setup Application 627

User Interface Editor 630

Deploying Different Solutions 633

Summary 637

Appendix A: Exercise Solutions 639

Appendix B: Where to Now? 655

INDEX 661

ReadMe doc
Download
Chapter 01 Code Downloads
Download
Chapter 02 Code Downloads
Download
Chapter 03 Code Downloads
Download
Chapter 04 Code Downloads
Download
Chapter 05 Code Downloads
Download
Chapter 06 Code Downloads
Download
Chapter 07 Code Downloads
Download
Chapter 08 Code Downloads
Download
Chapter 09 Code Downloads
Download
Chapter 10 Code Downloads
Download
Chapter 11 Code Downloads
Download
Chapter 12 Code Downloads
Download
Chapter 13 Code Downloads
Download
Chapter 14 Code Downloads
Download
Chapter 15 Code Downloads
Download
Chapter 16 Code Downloads
Download
Chapter 17 Code Downloads
Download
Chapter 18 Code Downloads
Download
Chapter 19 Code Downloads
Download
Chapter 20 Code Downloads
Download
All Code Downloads for the book
Download
ChapterPageDetailsDatePrint Run
42Error in Text
Page 42 - Comments

"Comments and whitespace and the two primary means..."
Second "and" should be "are"

List item #1 - "valusssse" should be "values"

List item #1 - "inNumber" should be "intNumber"
08/06/2010

45Error in Text
second paragraph:

Now reads: "...you?ll see how to add, subtract, multiple, and divide integer numbers."

Should read: "...you'll see how to add, subtract, multiply, and divide integer numbers."
11/15/2011

47Error in Code
The line "intNumber -= 2" under "Try It Out" should be bold.
06/18/2010

117Error in Text
Reads:

'Tell the user MessageBox.Show("Found it, exiting the loop now.", "Loops")"

Should read:

'Tell the user
MessageBox.Show("Found it, exiting the loop now.", "Loops")
09/08/2010

5129Error in Code
A portion of the code example is missing boldfacing.
This is how it should be bolded:
Private Sub btnMoreArrayParameters_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnMoreArrayParameters.Click
 
    ?Clear the list
    ClearList()
 
    ?Declare an array
    Dim strMoreFriends(1) As String
 
    ?Populate the array
    strMoreFriends(0) = ″Elaine″
    strMoreFriends(1) = ″Debra″
 
    ?List your friends
    AddItemsToList(strFriends)
    AddItemsToList(strMoreFriends)
End Sub
02/27/2012

413Error in Text
The reference to Chapter 25 should be deleted, as the chapter was cut from the book.
5/5/10