dot or comma?
-
Hello! I made a small C# application where you need to enter float numbers. In the Dutch language/math they write floating point numbers with a ',' so for instance 1,5 In English they write a dot like 1.5 The strange thing is that in my application only floating point number with a comma are entered correctly. Could someone tell me why this is? When I would enter 1.234 my program thinks it means 12.34, only when I type 1,234 this float is entering my program correctly... Could anybody tell me what is happening here, I would prefer to use the English version only! But maybe .NET sees that I have a Dutch PC? Ranger. Novice
-
Hello! I made a small C# application where you need to enter float numbers. In the Dutch language/math they write floating point numbers with a ',' so for instance 1,5 In English they write a dot like 1.5 The strange thing is that in my application only floating point number with a comma are entered correctly. Could someone tell me why this is? When I would enter 1.234 my program thinks it means 12.34, only when I type 1,234 this float is entering my program correctly... Could anybody tell me what is happening here, I would prefer to use the English version only! But maybe .NET sees that I have a Dutch PC? Ranger. Novice
I have been looking around and found an interface called IFormatProvider but that this stuff is really complicated. It has to do with local standards, how countries have different ways of displaying things. Just like I expected. Can you switch off this local way of interpreting information? Ranger. Novice
-
I have been looking around and found an interface called IFormatProvider but that this stuff is really complicated. It has to do with local standards, how countries have different ways of displaying things. Just like I expected. Can you switch off this local way of interpreting information? Ranger. Novice
Ranger49 wrote:
Can you switch off this local way of interpreting information?
Yes, if you pass
CultureInfo.InvariantCulture
as IFormatProvider. -- modified at 8:08 Sunday 6th May, 2007
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
-
Ranger49 wrote:
Can you switch off this local way of interpreting information?
Yes, if you pass
CultureInfo.InvariantCulture
as IFormatProvider. -- modified at 8:08 Sunday 6th May, 2007
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
-
Hello! I made a small C# application where you need to enter float numbers. In the Dutch language/math they write floating point numbers with a ',' so for instance 1,5 In English they write a dot like 1.5 The strange thing is that in my application only floating point number with a comma are entered correctly. Could someone tell me why this is? When I would enter 1.234 my program thinks it means 12.34, only when I type 1,234 this float is entering my program correctly... Could anybody tell me what is happening here, I would prefer to use the English version only! But maybe .NET sees that I have a Dutch PC? Ranger. Novice