The problem is the culture being used to make the conversion. Probably, your operating system is configured for a culture that does not consider the point (i.e. .
) as decimal separator.
To make the conversion, in this case you cannot let the method Convert.ToDouble
use the standard operating system culture.
For this it is possible to pass a parameter to the method Convert.ToDouble
indicating the crop:
Convert.ToDouble(ValueString, CultureInfo.InvariantCulture);
CultureInfo.InvariantCulture
: is a culture that does not vary with time. The decimal point is always .
.
Can you translate the question to English please?
– Sergio
I am trying to convert a string to double in Vb.net: Dim result as double dim Valuestring as string = -42.1942339 result = Convert.Todouble(Valuestring) Console.Writeline(result) I am receiving the following value -421942339 What I’m doing wrong?
– David Coopermine