Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 28th, 2006, 10:01 AM
Authorized User
 
Join Date: Jan 2006
Location: , , .
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.
  #2 (permalink)  
Old August 30th, 2006, 02:51 AM
Authorized User
 
Join Date: Dec 2003
Location: , , United Kingdom.
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

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.