Strange conversion error

Endev8003

Senior Member
Joined
Jun 19, 2008
Messages
822
Reaction score
3
Location
Bryanston
I'm having a strange error when converting a string to an integer.

An example of the string I'm converting is "4,642.00". I'm using VB.Net and using the CInt function to convert it. On my local development server and our live and test servers, it works without problem.

On one of my fellow developer's machine, it doesn't. It keeps giving a "System.FormatException: Input string was not in a correct format." error.

I have checked the regional settings on his pc and the .Net Globalization settings in IIS. It's the same as my pc. I ahve also tried to change my own settings, in an attempt to replicate the error, but no such luck. I have no idea what is causing it.

Both of us are using VB.Net in Visual Studio 2010 on Windows 7 and IIS 7 for the website?

Anyone have an idea of what else I can check?
 
My guess is that it's that pesky comma after the 4
 
Managed to fix it. We added a globalization entry in the web.config file that is in the .Net Framework folder. That managed to fix it on the guy's pc.

Strangely, it seems that my pc doesn't care about any globalization settings in this file or the site's web.config file.
 
Top
Sign up to the MyBroadband newsletter
X