Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 28th, 2006, 10:01 AM
Authorized User
 
Join Date: Jan 2006
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Default Errata - Chapter 9, Page 296, C#

Near the bottom of the page, there's this line of code:
Code:
Label1.Text = Convert.ToInt32(TextBox1.Text) + Convert.ToInt32(TextBox.Text);
First, (TextBox.Text) should be (TextBox2.Text). Second, this line will give a compile error:
Quote:
quote:
Cannot implicitly convert type 'int' to 'string'
In order for this to work, the numbers have to be converted back to a string.

Also in Chapter 9, when I press F5 or Ctrl + F5 to run the Begin\Chapter09\ web site, I get a compile error:
Quote:
quote:
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /Chapter09/ForEach.aspx
There are a lot of errors in this book. It really should be proofed and the code tested more thoroughly.
 
Old August 30th, 2006, 02:51 AM
Authorized User
 
Join Date: Dec 2003
Posts: 46
Thanks: 0
Thanked 1 Time in 1 Post
Default

Rob

The first is a simple typo and should be, as you say, TextBox2.Text.

The second is more interesting and shows a) a major difference between VB and C#, and b) I didn't check the code (more on that later). The line should be:

Label1.Text = (Convert.ToInt32(TextBox1.Text) + Convert.ToInt32(TextBox2.Text)).ToString();

This adds the two numbers together and then converts them back into a string to display.

The error here is completely mine and is interesting. In VB you don't need to convert the two numbers back to a string - it is implicitly done for you. When I converted this chapter from VB I completely forgot this and didn't try the code becuase it wasn't going to be part of the code that finally shipped. An oversight and I should have been more careful; I can only apologise.

Dave






Similar Threads
Thread Thread Starter Forum Replies Last Post
Errata - Chapter 9, Page 322, C# RobC BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 4 November 23rd, 2007 08:28 PM
Errata - Chapter 9, Page 337, C# RobC BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 2 August 30th, 2006 08:17 AM
Errata - Chapter 9, Page 336, C# RobC BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 August 30th, 2006 03:06 AM
Errata - Chapter 9, Page 299, C# RobC BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 1 August 30th, 2006 03:03 AM
Figure 6.5, Page 296 Nick Y BOOK: Ivor Horton's Beginning Visual C++ 2005 0 June 4th, 2006 02:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.