?
Solved

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

Posted on 2006-10-24
7
Medium Priority
?
571 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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 750 total points
ID: 17806164
Oh...MUI stands for Multilingual User Interface Technology, by the way.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

765 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