Hello

I have a problem to convert a String to double.
I use the below code but the messageBox show 11,07 with a Comma(",") instead of a dot(".")

I beleive this depends on any regional settings on the computer. On my other computer I get the result "11.07" which is correct. (However both computers are using XP Professional and have the same Timezone settings)

I wonder if it is possible to force the whole application to only use "." as a comma delimiter or do I have to change thousands of conversions one by one?

String^ num = "11.07";
            double  nums = Convert::ToDouble(num);
            
            MessageBox::Show(nums->ToString()); //Shows "11,07"

Edited 5 Years Ago by Jennifer84: n/a

I think the conversion of the decimal to comma is because your system is using the wrong locale, one that uses commas for decimal points.

Hello

I have a problem to convert a String to double.
I use the below code but the messageBox show 11,07 with a Comma(",") instead of a dot(".")

I beleive this depends on any regional settings on the computer. On my other computer I get the result "11.07" which is correct. (However both computers are using XP Professional and have the same Timezone settings)

I wonder if it is possible to force the whole application to only use "." as a comma delimiter or do I have to change thousands of conversions one by one?

String^ num = "11.07";
            double  nums = Convert::ToDouble(num);
            
            MessageBox::Show(nums->ToString()); //Shows "11,07"

i think its

string myString="554.67";
double myDouble = myString.toDouble();

Edited 5 Years Ago by James19142: n/a

This article has been dead for over six months. Start a new discussion instead.