Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2005 Instant Results BOOK ISBN: 978-0-470-11871-9
This is the forum to discuss the Wrox book Visual Basic 2005 Instant Results by Thearon Willis; ISBN: 9780470118719
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2005 Instant Results BOOK ISBN: 978-0-470-11871-9 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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 7th, 2007, 09:34 AM
Registered User
Points: 32, Level: 1
Points: 32, Level: 1 Points: 32, Level: 1 Points: 32, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Marietta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Errors in Desktop Weather

Two errors when entering 30068 as a zip code and pressing Go:

In the immediate window: A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll

And: in btnGo_click: "Conversion from string "-84.4433," to type 'Decimal' is not valid."

I new to .Net so I wonder if this is my system settings or a true bug in the oode.

I am enjoying your book - Thanks!

J. H. Rainwater
__________________
J. H. Rainwater
Reply With Quote
  #2 (permalink)  
Old August 7th, 2007, 06:03 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Location: Fuquay Varina, NC, USA.
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

J.H.,

In the WeatherData class, in the ZipCodeLookup procedure, replace this line of code:

            decLongitude = CType(strZipCodeCoordinates.Substring( _
                strZipCodeCoordinates.IndexOf(",") + 2, _
                strZipCodeCoordinates.IndexOf(",", _
                strZipCodeCoordinates.IndexOf(",") - _
                strZipCodeCoordinates.IndexOf(","))), Decimal)

with

            decLongitude = CType(strZipCodeCoordinates.Substring( _
                strZipCodeCoordinates.IndexOf(",") + 2, _
                strZipCodeCoordinates.IndexOf(",", _
                strZipCodeCoordinates.IndexOf(",") - _
                strZipCodeCoordinates.IndexOf(","))).Replace(",", ""), Decimal)

It appears that the original code isleaving a comma in the string in some cases which cannot be converted to a decimal value.

Thearon
Reply With Quote
  #3 (permalink)  
Old August 8th, 2007, 01:12 PM
Registered User
Points: 32, Level: 1
Points: 32, Level: 1 Points: 32, Level: 1 Points: 32, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Marietta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That fixed this problem, I'm submitting another issue in a new posting.

J. H. Rainwater
Reply With Quote
Reply


Thread Tools
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
Chapter2:problem in rendering weather table samouille666 JSP Basics 0 January 17th, 2007 09:50 AM
How to check weather webservices installed or not raju@wrocks C# 0 December 13th, 2006 06:13 AM
new weather web service cherry Book: Wrox's Visual C# 2005 Express Edition Starter Kit 0 September 6th, 2006 01:52 PM
Detect weather IIS installed on user machine in c# saeedahmed C# 1 January 5th, 2006 12:37 PM



All times are GMT -4. The time now is 10:19 PM.


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