473,411 Members | 2,196 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

double.Parse ignores NumberDecimalSeparator

Hi all,

in my system NumberDecimalSeparator is set to ',' so why doing:

double toDo = double.Parse(dr["toDo"].ToString()));

toDo is something like 123.0 ?!?!?!

Thanks in advance :-)
Nov 17 '05 #1
1 3143
you should be doing something like this:

CultureInfo ci = new CultureInfo(CultureInfo.CurrentCulture.Name,
false);
NumberFormatInfo formatInfo = ci.NumberFormat;
formatInfo.NumberDecimalDigits = 4;
formatInfo.NumberDecimalSeparator = ".";
formatInfo.NumberGroupSeparator = ",";
int[] mySizes = {2,2,2};
formatInfo.NumberGroupSizes = mySizes;

double toDo = 12221223.567442;

string val = toDo.ToString("N", formatInfo);
Console.WriteLine(val);

This will out the following - 12,22,12,23.5674
HTH

Ollie Riches
"Marco" <ma*************@spam.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
Hi all,

in my system NumberDecimalSeparator is set to ',' so why doing:

double toDo = double.Parse(dr["toDo"].ToString()));

toDo is something like 123.0 ?!?!?!

Thanks in advance :-)

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jesper Denmark | last post by:
Hi, I use the double.Parse functionality to convert a number in a text file into a double. However, while this works fine on one computer it doesn't on another. I've found out that it is...
1
by: Kevin | last post by:
Why do I get different values for the same hex string when parsing to an integer versus a double? See the follwoing code snippet: using System; using System.Collections; using...
5
by: Adam Klobukowski | last post by:
Hello I need to convert some strings int doubles. Unfortunetly strings do not follow my country culture standarts (we use , to separate decimal from fraction, but strings use . there etc.). ...
3
by: slylos | last post by:
I've got a section of code in my app that keeps track of how much time an employee has accrued, which equals out to 1.33 days of PTO per month. I'm trying to store the time accrued so far in an...
5
by: Markus Kling | last post by:
"double.Parse(double.MaxValue.ToString())" yields the following Exception: Value was either too large or too small for a Double. at System.Number.ParseDouble(String value, NumberStyles options,...
4
by: Daniel Walzenbach | last post by:
Hi, I wonder if somebody could explain me the difference between Double.Parse and Convert.ToDouble. If I'm not mistaken they are implemented differently (I though for a moment they might be the same...
2
by: Samuel R. Neff | last post by:
I'm using a quasi open-source project and am running into an exception in double.Parse which is effectively this: double.Parse(double.MinValue.ToString()) System.OverflowException: Value was...
1
by: schaf | last post by:
Hi NG! I have a little question about the localization of a double. If I use the CultureInfo "en-US" I have the following behavior: 1.) If I enter the value 2.5 into a textbox the...
2
by: Mika M | last post by:
Hi, Just for fun I'm trying to parse my GPS position string using C# 2005. When my code is trying to parse latitude string to double value like... double.Parse(items); // items = "6215.1058"...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.