469,336 Members | 5,820 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

International Number Formats

I am currently working on an application that is being
used mostly in the US but recently has been purchased by
several users outside the US, mostly in South America. The
application uses an Access 2000 database for storing the
data.

The problem I am seeing is that when numbers and currency
values are entered into the application, the regional
settings of the users machine formats the numbers to use
their local settings. For example, if you enter $1,000.00
the number is automatically transformed to $1.000,00 which
is how the Spanish language treats the number. When the
application attempts to store the number in the database,
an error occurs. The error states "Cast from string
$1.000,00 to type 'Single' is not valid".

Since I do not specifically add the punctuation or control
the format in any way in the code, I am not sure how to
approach the problem. If anyone has any ideas, I would be
very grateful for your suggestions. I would like to
resolve the problem in such a way that I do not have to
have different versions for different areas of the world.

Thanks in advance for any assistance you might be able to
provide!
Jul 21 '05 #1
1 1603
You can parse for other cultures' number formats
explicitly by specifying their culture info in a parse
method:

Console.WriteLine(Int32.Parse("1.000,00",
NumberStyles.Any, new CultureInfo("es-AR")));

Where es-AR = español Argentina (see the CultureInfo class
docs for all cultures)

There are more sophisitcated ways to accomodate cultures
in your apps, but I'm not familiar with them (try
searching for Globalization in .NET, should turn up some
resources).

Richard
-----Original Message-----
I am currently working on an application that is being
used mostly in the US but recently has been purchased by
several users outside the US, mostly in South America. The application uses an Access 2000 database for storing the
data.

The problem I am seeing is that when numbers and currency
values are entered into the application, the regional
settings of the users machine formats the numbers to use
their local settings. For example, if you enter $1,000.00
the number is automatically transformed to $1.000,00 which is how the Spanish language treats the number. When the
application attempts to store the number in the database,
an error occurs. The error states "Cast from string
$1.000,00 to type 'Single' is not valid".

Since I do not specifically add the punctuation or control the format in any way in the code, I am not sure how to
approach the problem. If anyone has any ideas, I would be
very grateful for your suggestions. I would like to
resolve the problem in such a way that I do not have to
have different versions for different areas of the world.

Thanks in advance for any assistance you might be able to
provide!
.

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by MarionEll | last post: by
15 posts views Thread by Steve | last post: by
reply views Thread by MarionEll | last post: by
4 posts views Thread by Vladislav Moltchanov | last post: by
1 post views Thread by Roger | last post: by
5 posts views Thread by Kevin Newman | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.