Skip to main content

Mastering Visual Basic .NET

Mastering Visual Basic .NET

Evangelos Petroutsos

ISBN: 978-0-782-15234-0

Feb 2006

1184 pages

Select type: E-Book


Product not available for purchase


VB Programmers: Get in Step with .NET

With the introduction of Visual Basic .NET, VB transcends its traditional second-class status to become a full-fledged citizen of the object-oriented programming, letting you access the full power of the Windows platform for the first time. Written bythe author of the best-selling Mastering Visual Basic 6 this all-new edition is the resource you need to make a successful transition to .NET. Comprising in-depth explanations, practical examples, and handy reference information, its coverage includes:

  • Mastering the new Windows Forms Designer and controls
  • Building dynamic forms
  • Using powerful Framework classes such as ArrayLists and HashTables
  • Persisting objects to disk files
  • Handling graphics and printing
  • Achieving robustness via structured exception handling and debugging
  • Developing your own classes and extending existing ones via inheritance
  • Building custom Windows controls
  • Building menus and list controls with custom-drawn items
  • Using ADO.NET to build disconnected, distributed applications
  • Using SQL queries and stored procedures with ADO.NET
  • Facilitating database programming with the visual database tools
  • Building web applications with ASP.NET and the rich web controls
  • Designing web applications to access databases
  • Using the DataGrid and DataList web controls
  • Building XML web services to use with Windows and web applications
  • Special topics like the Multiple Document Interface and powerful recursive programming techniques

Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.


Part I: The Fundamentals.

Chapter 1: Getting Started with VB.NET.

Chapter 2: Visual Basic Projects.

Chapter 3: Visual Basic: The Language.

Chapter 4: Writing and Using Procedures.

Chapter 5: Working with Forms.

Chapter 6: Basic Windows Controls.

Chapter 7: More Windows Controls.

Part II: Rolling Your Own Objects.

Chapter 8: Building Custom Classes.

Chapter 9: Building Custom Windows Controls.

Chapter 10: Automating Microsoft Office Applications.

Part III: Basic Framework Classes.

Chapter 11: Storing Data in Collections.

Chapter 12: Handling Strings, Characters, and Dates.

Chapter 13: Working with Folders and Files.

Part IV: Intermediate Programming.

Chapter 14: Drawing and Painting with Visual Basic.

Chapter 15: Printing with VB.NET.

Chapter 16: The TreeView and ListView Controls.

Chapter 17: Error Handling and Debugging.

Chapter 18: Recursive Programming.

Chapter 19: The Multiple Document Interface.

Part V: Database Programming with VB.NET.

Chapter 20: Databases: Architecture and Basic Concepts.

Chapter 21: Building Database Applications with ADO.NET.

Chapter 22: Programming the ADO.NET Objects.

Part VI: VB.NET on the Web.

Chapter 23: Introduction to Web Programming.

Chapter 24: Accessing Data on the Web.

Chapter 25: XML Web Services.


Tutorial 1: Writing Multithreaded Applications iwth VB.NET
Tutorial 2: The Validation Project - Using the ErrorProvider Control
Tutorial 3: The ImageExplorer Project - Using the TreeView and ListView Controls
Download Treeview app and Project Files
Download a .zip file with the project files used in the book.
To uncompress the file, Windows users can use Windows built-in ZIP utilities or a 3rd party utility like WinZip or WinRAR. Macintosh users can simply double-click the downloaded file to extract using the built-in archive utility.
ZIP file containing projects from Chapter 9
ZIP file containing projects from Chapter 10
ZIP file containing projects from Chapter 19
Zip file containing updated My Contacts from Chapter 5
ZIP file containing the Matrix project
ChapterPageDetailsDatePrint Run
Combined Errata,

Page 0 CD

Contact example from the CD Chapter 5 has an error. .
Oops, there's an error indeed.

The following statement in the SaveContact() subroutine:
contact = CType(MyContacts.Item(currentContact), Contact)

had to be changed to:

If Not adding Then

contact = CType(MyContacts.Item(currentContact), Contact)

End If

Download the updated Zip file containing My Contacts from Chapter 5 at:,typeCd-DOWNLOAD.html

Page 100

In the Code Listing, 3.4, An error is generated.
.Chars is not a member of .Char

Line as Written
If Not system.Char.Chars(i).IsLetterOrDigit(password.Chars(i)) Then

Should Read
If Not System.Char.IsLetterOrDigit(password.Chars(i)) Then

Page 121

3rd Paragraph, 4th line reads State.Intederminate , should be State.Indeterminate

Page 202

Third paragraph, 1st sentence right should be left

3rd paragraph, 4th sentence, left should be right

Page 208

Last paragraph, is incorrect.
The Startup object doesn't change when you change its name in the Solution Explorer,
which is the form's file name. If you change the form's name in the Property
Browser, you must change the project's properties.

Page 272

Listing 6.12, Please replace the listing with the following:
Private Sub bttnMoveDest_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) _
Handles bttnMoveDest.Click

While sourceList.SelectedIndices.Count > 0
End While
End Sub

Page 376

Line 12 of Listing 8.38:
Please change:
perim = Perimeter()
perim = Perimeter() / 2

Page 426

Section "Designing Owner-Drawn ListBox Controls",
The code discussed in the book will work, but you can find a better implementation of the owner-drawn ListBox control in the code posted here. The project is the OwnerDrawnList project and it contains a README.TXT file that describes the changes.

Page 436

I am getting the error "wordapp.quit()" :
***Please see "downloads section" for updated CH 10 files.

This issue was introduced in one of the pre-release versions of Visual Studio and the solution is to replace the statement:


with the following:

Actually, I was aware of this bug, but I was expecting it would be fixed by
the final release. I guess it's too late to correct the Office object model
and we'll have to live with this (inelegant) workaround.

I have revised the projects of chapter 10 and I'm attaching a ZIP file with the latest version of the projects. The affected projects contain a
README.TXT file that describes the workaround in detail.

April 1, 2002



The original application (as discussed in the book),calls the Document.Close method to close an open document and the Application.Quit method to terminate Word. However, you can't call these methods directly - if you do, an exception
will be raised, because these two method names are not unique in their namespace.

To close a document, convert the Document object
that represents an open document to the Word._Document type and then call the Close method:

CType(thisDoc, W