Microsoft Visual C# 2005 Step by Step comments and corrections

Summary

This article contains comments, corrections, and information about known errors relating to the Microsoft Press book Microsoft Visual C# 2005 Step by Step, ISBN 0-7356-2129-2.

The following topics are covered:

  • Incorrect pathway to practice file locations
  • Page 27: 2 to the 16th power represented as 32,768 rather than 65,536
  • Page 27: Eight exponents not printed as exponents
  • Page 33: Math error
  • Page 40: -- operator not printed correctly
  • Page 46: Statement incorrectly uses two closing brackets
  • Page 52, Item #7 has missing parenthesis
  • Page 60: Incorrect operator in Table
  • Page 61: Error in sample code
  • Page 79: OpenFileDialog class referenced in place of FileInfo class
  • Page 90: "current + digit" should be "digit + current"
  • Page 99: Code sample missing open bracket
  • Page 100: Code sample missing closing bracket
  • Page 120: Application should be Program
  • Page 124: x and y referenced in place of this.x and this.y
  • Page 146: dotted "unboxing" arrow in figure pointing to the incorrect box
  • Page 165: defaultDate should be default Date
  • Page 167: Variable name Summer used in place of Spring in example code
  • Page 253: "103" should be "96"
  • Page 276: Sample code error
  • Page 287: this.Enabled should be this.ticking.Enabled
  • Page 322: Error in code in step 6
  • Page 339: minute should be this.minute and hour should be this.hour
  • Page 343: Code sample missing carriage return
  • Page 345: rhs)s should be rhs)
  • Page 435: NumProductsTableTableAdapter should be NumProductsTableAdapter
  • Page 475: Additional code required in Step 13
  • Page 500: asps should be aspx
  • Page 523: Backslash missing

More Information

Incorrect pathway to practice file locations

In the book, all references to the path:

"My Documents\Visual C Sharp Step by Step"



should read:

"My Documents\Microsoft Press\Visual C Sharp Step by Step"

Page 27: 2 to the 16th power represented as 32,768 rather than 65,536

On page 27, the line immediately below the table reads:



"* The value of 216 is 32,768; the value of 231 is 2,147,483,648; and the value of 263 is 9,223,372,036,854,775,808."



With numerals in parentheses indicating exponents, it should read:



"* The value of 2(16) is 65,536; the value of 2(31) is 2,147,483,648; and the value of 2(63) is 9,223,372,036,854,775,808."

Page 27: Eight exponents not printed as exponents

On page 27, there are eight occurances of exponents not printed as such. All numerals enclosed in parenthesis in the corrections below should be printed in the exponent position.

The Range column of the int row in the table reads:



"<->231 through 231<->1"



It should read:



"<->2(31) through 2(31)<->1"



The Range column of the long row in the table reads:



"<->263 through 263<->1"



It should read:



"<->2(63) through 2(63)<->1"



The Range column of the char row in the table reads:



"0 through 216 <–>1"



It should read:



"0 through 2(16) <–>1"



The line immediately below the table reads:



"* The value of 216 is 32,768; the value of 231 is 2,147,483,648; and the value of 263 is 9,223,372,036,854,775,808."



It should read:



"* The value of 2(16) is 32,768; the value of 2(31) is 2,147,483,648; and the value of 2(63) is 9,223,372,036,854,775,808."


Page 33: Math error

On page 33, within the modules example, the row above the note currently reads:



"9 divided by 2 is 8, remainder 1"

It should read:

"9 divided by 2 is 4, remainder 1"

Page 40: -- operator not printed correctly

On page 40, the "Increment or decrement a variable" section of the Chapter 2 Quick Reference table reads:



"Use the ++ or <;$MI><;$MI> operator. For example:

count++;"



It should read:



"Use the ++ or -- operator. For example:

count++;"


Page 46: Statement incorrectly uses two closing brackets

On page 46, in step 4 the code sample statement reads:



calculatedvalue = addvalues(leftHandSide, rightHandSide));

It should read:



calculatedvalue = addvalues(leftHandSide, rightHandSide);


Page 52, Item #7 has missing parenthesis

On Page 52, in Item #4, the last row from the bottom reads:

"private double calculateFee double dailyRate, int noOfDays)"



It should read:



"private double calculateFee(double dailyRate, int noOfDays)"

Page 60: Incorrect operator in Table

On Page 60, in the first table under 'Understanding Equality and Relational Operations', there are incorrect entries in the first row in the 'Operator' and 'Example' columns.



In the Operator column, replace:


--

with
==



In the Example column, replace:


age -- 100

with
age == 100

Page 61: Error in sample code

On page 61, within the TIP, the second line of sample code reads:


validPercentage = percent >=0 && percent <= 100 validPercentage = (percent >=0) && (percent <=100)

It should read:


validPercentage = percent >=0 && percent <= 100

and

validPercentage = (percent >=0) && (percent <=100)


Page 79: OpenFileDialog class referenced in place of FileInfo class

On page 79, the fourth sentence in the second paragraph of step 9 reads:



"The OpenFileDialog class provides the OpenText method for opening the file selected by the user in the Open dialog."



It should read:



"The FileInfo class provides the OpenText method for opening the file selected by the user in the Open dialog."

Page 90: "current + digit" should be "digit + current"

On page 90, the code listed in step 13 is incorrect.



Change:
current = current + digit;

To:
current = digit + current;

Page 99: Code sample missing open bracket

On page 99, the code sample in Step 8 is missing an opening bracket before the word "try".



Change:
try
{
int leftHandSide = Int32.Parse(leftHandSideOperand.Text);
int rightHandSide = Int32.Parse(rightHandSideOperand.Text);
int answer = doCalculation(leftHandSide, rightHandSide);
result.Text = answer.ToString();
}

To:
{
try
{
int leftHandSide = Int32.Parse(leftHandSideOperand.Text);
int rightHandSide = Int32.Parse(rightHandSideOperand.Text);
int answer = doCalculation(leftHandSide, rightHandSide);
result.Text = answer.ToString();
}

Page 100: Code sample missing closing bracket

On page 100, the code sample in Step 9 is missing a closing bracket.



Change:
catch (FormatException fEx)
{
result.Text = fEx.Message;
}

To:

catch (FormatException fEx)
{
result.Text = fEx.Message;
}
}

Page 120: Application should be Program

On page 120, the first sentence of step 5 refers to the Application class rather than the Program class.



Change:

"Return to the Program.cs file, and locate the Entrance method of the Application class."




To:

"Return to the Program.cs file, and locate the Entrance method of the Program class."

Page 124: x and y referenced in place of this.x and this.y

On page 124, the sample code for step 3 reads:



public double DistanceTo(Point other)
{
int xDiff = x - other.x;
int yDiff = y - other.y;
}


It should read:



public double DistanceTo(Point other)
{
int xDiff = this.x - other.x;
int yDiff = this.y - other.y;
}

Ths sample code for step 4 reads:



public double DistanceTo(Point other)
{
int xDiff = x - other.x;
int yDiff = y - other.y;
return Math.Sqrt(xDiff * xDiff + yDiff * yDiff);
}


It should read:



public double DistanceTo(Point other)
{
int xDiff = this.x - other.x;
int yDiff = this.y - other.y;
return Math.Sqrt(xDiff * xDiff + yDiff * yDiff);
}


Page 146: dotted "unboxing" arrow in figure pointing to the incorrect box

On page 146, the first figure on the page has the "unboxing" dotted arrow pointing to the Heap 42 box on the right. It should be reversed so that it is coming from that box and pointing to the Stack 42 box on the bottom left.

Page 165: defaultDate should be default Date

On page 165, the first sentence of step 7 contains the words defaultDate twice. The second instance needs to have a space between default and Date.



Change:


"Add a statement to the end of the Entrance method to declare a local variable called defaultDate and initialize it to a Date value constructed by using the defaultDate constructor."



To:


"Add a statement to the end of the Entrance method to declare a local variable called defaultDate and initialize it to a Date value constructed by using the default Date constructor."

Page 167: Variable name Summer used in place of Spring in example code

On page 167, the first line of sample code in the "Initialize or assign an enumeration variable to a value" section of the Chapter 9 Quick Reference table reads:



currentSeason = Season; // compile time error


It should read:



currentSeason = Spring; // compile time error


Page 253: "103" should be "96"

On page 253, the 2nd sentence of Step 7 contains an incorrect value.



Change:

"The Windows form displays the two text boxes containing the values 232 and 103."



To:

"The Windows form displays the two text boxes containing the values 232 and 96."

Page 276: Sample code error

On page 276, the second-to-last code sample contains an error. Beginning with the sentence immediately preceding the code sample, it reads:


"You can remove a method from a delegate by using the -= operator:



this.stopMachinery += folder.StopFolding; "

It should read:


"You can remove a method from a delegate by using the -= operator:



this.stopMachinery -=folder.StopFolding;"


Page 287: this.Enabled should be this.ticking.Enabled

On page 287, the last line of the code sample in step 6 is incorrect.



Change:
this.Enabled = true;

To:
this.ticking.Enabled = true;

Page 322: Error in code in step 6

On page 322, the code sample reads:


foreach (int data in tree1)
Console.WriteLine(data);


The code sample should have the second line indented:


foreach (int data in tree1)
Console.WriteLine(data);


Page 339: minute should be this.minute and hour should be this.hour

On page 339, the first code sample is incorrect.



Change:
if (minute == 0)
{
hour++;
}

To:
if (this.minute == 0)
{
this.hour++;
}

Page 343: Code sample missing carriage return

On page 343, the last code sample is incorrect.



Change:
void Example(Hour a, int b)
{
Hour eg1 = a + b; // b converted to an Hour Hour eg2 = b + a; //
b converted to an Hour
}

To:
void Example(Hour a, int b)
{
Hour eg1 = a + b; // b converted to an Hour
Hour eg2 = b + a; // b converted to an Hour
}

Page 345: rhs)s should be rhs)

On page 345, the fifth line of the code sample in the "Implement an operator." row of the table contains an extra character.



Change:
Hour rhs)s

To:
Hour rhs)

Page 435: NumProductsTableTableAdapter should be NumProductsTableAdapter

On page 435, the second sentence of step 14 contains an incorrect reference.



Change:

"Click the DataTable1TableAdapter and change its name to NumProductsTableTableAdapter."



To:

"Click the DataTable1TableAdapter and change its name to NumProductsTableAdapter."

Page 475: Additional code required in Step 13

On page 475, the following code should be added to the end of the sample code block in step 13:



bossButton.Checked = false;
vpButton.Checked = false;
presidentButton.Checked = false;


Page 500: asps should be aspx

On page 500, the last sentence of step 15 refers to the wrong file.



Change:

"The start page for the application is CustomerData.asps, but as you have not yet logged in, you are directed to the LoginForm."



To:

"The start page for the application is CustomerData.aspx, but as you have not yet logged in, you are directed to the LoginForm."

Page 523: Backslash missing

On page 523, the path in step 3 is missing a backslash.



Change:

"In the tree view in the left-hand pane, expand My Computer\HKEY_LOCAL_MACHINE\SYSTEMCurrentControlSet\Services\Eventlog."



To:

"In the tree view in the left-hand pane, expand My Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog."

Microsoft Press is committed to providing informative and accurate books. All comments and corrections listed above are ready for inclusion in future printings of this book. If you have a later printing of this book, it may already contain most or all of the above corrections.

The print number of the book is located on the copyright page in the form of a string of numbers. For example: "2 3 4 5 6 7 8 0 QWT 9 8 76 5 4". The first number in the string is the the print number. In this example, the print number is 2.
Propriedades

ID do Artigo: 905035 - Última Revisão: 20 de jun de 2014 - Revisão: 1

Comentários