Solved

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

Posted on 2006-10-24
7
564 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

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…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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