Topic: Visual Basic

Mastering Microsoft® Visual Basic® 2005 (0782143490) cover image

Mastering Microsoft® Visual Basic® 2005

Evangelos Petroutsos
ISBN: 978-0-7821-4349-2
Paperback
1408 pages
January 2006
This title is out-of-print and not currently available for purchase from this site.
About This Title  |  Download Code  |  Errata

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
227 Text Correction
On page 227 the first sentence in the second paragraph states "If you use the MouseUp event handler instead, ..." It should read "If you use the KeyUp event handler instead, ..."
227 Text Correction
The second paragraph on page 227 implies that using the KeyDown event to process the Enter key should produce a "quiet" event. However, it still produces a Beep sound. Replace the statement that sets the Handled method with the following in the KeyDown event handler:

e.SuppressKeyPress = True

and to get rid of the beep.

70 Text Correction
The first sentence in the last paragraph on page 70 states "You can also produce an infinity value by multiplying a very large (or a very small) number by itself many times."
It should read
"You can also produce an infinity value by multiplying a very large number by itself many times, or by dividing a large number by a very small number repeatedly."
90 Text Correction
The 2nd paragraph on page 90 states "Using this structure, you can store up to 10 e-mail addresses per person" referring to the structure field Email dimensioned as "Dim Email(10) as String".

This sentence is incorrect and should read "Using this structure, you can store up to 11 e-mail addresses per person". Or the dimension field statement should changed to read "Dim Email(9) as String".

90 Text Correction
The 3rd paragraph on page 90 states "This array can hold contact information for 1,000 persons ..." referring to the array of structures dimensioned as "Dim allPeople(1000) as Person".

This sentence is incorrect and should read "This array can hold contact information for 1,001 persons ...". Or the structure dimension statement should changed to read "Dim allPeople(999) as Person".

188 Text Correction
The last paragraph on page 188 states "The keycode for the function key F1 is 112 (or the constant Key.F12), the keycode for F2 is 113 (or the constant Keys.F13) ...".

The constant for F1 is Keys.F1.
The constant for F2 is Keys.F2.

The constants are leftovers from previous versions of VB and they still work, but the code isn't elegant.

424 Text Correction
Listing 9.1 on page 424 will not work correctly. To fix the code please change
MyBase.RemoveAt(i)
to
MyBase.RemoveAt(j)
425 Text Correction
The text at the bottom of page 425 and the top of the following page should read:

Original List After Elimination of Duplicates
10 10
A A
20 20
87 87
c c
A b
b a
a 87
A 10
87 100
10 110
100 1001
110
1001
524 Text Correction
The code shown in Listing 22.8 on page 524 will produce an IndexOutOfRange Exception. To correct this problem the current character position (intcurrPos) must compared against the ordinal of the last character in the string, which is TextBox1.Text.Length - 1, and not TextBox1.Text.Length:

if intcurrPos >= Textbox1.Text.Length -1 Then

This statements appears three different times in Listing 22.8

373 Text Correction
Figure 8.4 on page 373 is the wrong one. The correct figure is included in the file F0804NEW.TIF
388 Text Correction
The statement

Dim contact1 As New Contact("Hardy", "Thomas")

shown on page 388 will result in an error because there are no constructors which have only two string parameters. You must add a third constructor to the class with the following statements:

Public Sub New(ByVal LastName As String, ByVal FirstName As String)
MyBase.New()
Me.ContactName = LastName & ", " & FirstName
End Sub

587 Text Correction
The code shown in Listing 13.14 does not produce the output shown at the bottom of page 587. Based on the code shown in Listing 13.14 (accounting for the fact that "area" is mispelled as "are"), the correct output should be:
The area of rectangle R1 is 100
The area of rectangle R2 is 400
The area of rectangle R3 is 4
527 Text Correction
The second sentence in the section "PadLeft, PadRight" should read
" ... with spaces to the left (for left-padded strings) or to the right (for right-padded strings)"

The values of strPadLeft and strPadRight shown in the middle of the page should be reversed. That is ...
[               Visual Basic Express] results from the PadLeft statement
[Visual Basic Express ] results from the PadRight statement

Finally, the first sentence in the paragraph preceding the TIP should be changed to read
"There are eight spaces to the left of the left-padded string and eight spaces to the right of right-padded strings."

141 Text Correction
The variable CTemp which is used in the following code segment:

CTemp = InputBox(“Enter temperature in degrees Celsius”)

should be declared As String, because the InputBox() function returns a string value.