Solved

Error: The currency separator information specified in the NumberFormatInfo is ambiguous for parsing

Posted on 2006-10-24
7
560 Views
Last Modified: 2012-06-27
In the solution of the question of the same title the follwing solution is given:
If any of the group separators ( NumberFormatInfo.NumberGroupSeparator, NumberFormatInfo.CurrencyGroupSeparator, or NumberFormatInfo.PercentGroupSeparator) is the same as any of the decimal separators ( NumberFormatInfo.NumberDecimalSeparator, NumberFormatInfo.CurrencyDecimalSeparator, or NumberFormatInfo.PercentDecimalSeparator), parsing ambiguous strings produces unpredictable results. If you explicitly set any of the group separator properties in NumberFormatInfo to a value that is the same as any of the decimal separators or if you explicitly set any of the decimal separators to a value that is the same as any of the group separators, ArgumentException is thrown.
But no way to solve the problem by interaction with the control panel / International Settings.
In particular, how can be set from the control panel the PercentGroupSeparator and the PercentDecimalSeparator?
0
Comment
Question by:leoprex1
  • 5
  • 2
7 Comments
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 17804899
Are you saying there is a difficulty with sequence here?

I.e., if you set PercentGroupSeparator to the same value as PercentDecimalSeparator you get a problem?

You could get around that by using an intermediate value.  Say you want to reverse current values of
PercentGroupSeparator=","
PercentDecimalSeparator="."

Just do
PercentGroupSeparator="!"
PercentDecimalSeparator=","
PercentGroupSeparator="."
0
 

Author Comment

by:leoprex1
ID: 17804984
Jensfiederer,
are you speaking setting the PrecentGroupSeparator programmatically or via Control Panel?
I do not know how to do it via Control Panel.
The problem arises on a PC to which I have not access and on which my software has been loaded.
People tried to set international settings as standard culture Italian or english-us without success.
They verified that the DecimalSep and GroupSep for numbers and currency are OK.
They get always this error. It occurs the first time the program passes to a subroutine an argument string.
Thank you for your cooperation
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 17805308
I thought you might be doing it programmatically, and possibly getting an error involving order of operations.

Doing it via Control Panel is easy, and needs no workarounds...you just go into "Regional and Language" options and set the separators.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 17805411
If you want to USE what you set in the control panel, use

system.Globalization.CultureInfo.CurrentUICulture.NumberFormat
0
 

Author Comment

by:leoprex1
ID: 17805508
My point is that in Regional settings I found the settings for the numbers and for the currency, but not for the percentages.
Another question:
which is the difference between Threading.Thread.CurrentThread.CurrentCulture and Globalization.CultureInfo.CurrentUICulture?
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 17806146
This link describes the differences:
http://www.developersdex.com/vb/message.asp?p=4102&ID=%3CO3u2BuKVGHA.2156%40tk2msftngp13.phx.gbl%3E

When you set the numeric format from the control panel, it ALSO (at least on my machine) changes PercentDecimalSeparator.  

Oddly, the first time I tried it I could see the difference in system.Globalization.CultureInfo.CurrentUICulture (but not in system.Globalization.CultureInfo.CurrentCulture), and the second time I tried it I could see the difference only in system.Globalization.CultureInfo.InstalledUICulture.

0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 250 total points
ID: 17806164
Oh...MUI stands for Multilingual User Interface Technology, by the way.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Single Form 8 42
C#.NET and microsoft certification. 3 40
C# bracket error 3 30
Problem with SelectList in .NET MVC application 1 11
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now