Solved

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

Posted on 2006-10-24
7
555 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

19 Experts available now in Live!

Get 1:1 Help Now