Visual Basic 2005 Cookbook

Errata for Visual Basic 2005 Cookbook

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page 17
3rd paragraph

The instructions for entering the result fields say to update the ID property of each
cell. This results in compile errors.

The downloaded example code has it right. A label needs to be added to each cell,
and the ID and TEXT properties set to the values shown in the downloaded example.

Note from the Author or Editor:
As the reader indicated, to produce the code contained in the downloadable samples, add an ASP Label control to each of the fields in the right column of the table. Then edit the properties for each of those three labels using the IDs indicated in the chapter text.

Anonymous    May 03, 2013
Page 37
Code in center of page

The reference to Left, ie:
namePart = Left(fullVariable, equalsPosition - 1)
results in the compile time error

'Public Property Left() As Integer' has no parameters and its return type cannot be

I used fullVariable.Substring(0, equalsPosition -1)

Note from the Author or Editor:
The statement as shown in the book is correct when used in a class or module. However, when the statement is used in the code-behind portion of a Windows Forms instance, the Form class's Left property takes priority over the Visual Basic Left function. In such cases, the full namespace path to the Left function can be used: Microsoft.VisualBasic.Left(). The reader's solution will also work.

Page 70
3rd paragraph

Beginning on the previous page, it discusses overloading and uses the Overloads
keyword. In paragraph 3 it says "And while constructors .... they do not require the
Overloads keyword."

That is true, but actually, it isn't required for overloading any function. If I have
two functions with the same name, but differnt signatures, VB 2005 will figure out
which one to use from the call. I'm not sure why the Overloads keyword even exists.

Note from the Author or Editor:
You are correct that the Overloads keyword is optional in method declarations. However, it should always be added for clarity. In the sentence you mentioned concerning constructors, changing the word "require" to "use" may make the sentence a little clearer.

Anonymous    May 03, 2013
Page 83
last paragraph

fails is spelled "faisl"

Anonymous    May 03, 2013
Page 114
2nd paragraph

The code shown in the 2nd paragraph results in an overflow error. I can't quite see why, but it does. It runs to the point where counter = 255 and then fails on the "Next counter" statement. The error is:
Arithmetic operation resulted in an overflow.

Note from the Author or Editor:
The reader is correct. Because For loops perform a test of the loop variable by adding (a default value of) 1 during each pass, adding 1 to 255 results in an overflow. The following code resolves the issue.

Dim origBytes(255) As Byte
For counter As Short = 0 to 255
origBytes(counter) = CByte(counter)
Next counter

The other loops on that page require similar modifications.

Anonymous    May 03, 2013
Page 686
Code Listing

Running this code gives a:

A first chance exception of type 'System.Web.Services.Protocols.SoapException'
occurred in System.Web.Services.dll

Does not like:

foundLocation = _

Note from the Author or Editor:
Recipe 17.8, "Calling a Web Service," used a Microsoft-sponsored public web service called TerraServer, located on the domain. After publication of the book, Aerial Images, the owner of the TerraServer trademark, sued Microsoft, demanding that it cease using that name for its mapping service. Microsoft changed the web site name in 2010 to However, that service was shut down in May 2012. The underlying mapping service on which the book’s sample web reference is based no longer exists. However, the service concepts demonstrated in the recipe are still valid, and can be used to reference similar services, such as Google Maps (visit or Bing Maps (visit, with some appropriate code adjustments.