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 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();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.