Solved

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

Posted on 2006-10-24
7
558 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

21 Experts available now in Live!

Get 1:1 Help Now