How can I convert a string to a double in german format.

  • Thread starter Thread starter Andrzej
  • Start date Start date
A

Andrzej

I have a string that represents a double: "1.00"
I need to convert this to german format.
Currently I get 100 when I do this CType(strCreditAmount, Double).
 
Andrzej said:
I have a string that represents a double: "1.00"
I need to convert this to german format.
Currently I get 100 when I do this CType(strCreditAmount, Double).

First parse it in whatever culture it's already in, then format the
result using the "target" culture. Look at
CultureInfo.InvariantCulture, CurrentInfo.CurrentCulture etc, and how
to create a CultureInfo instance for a specific country.
 
Ctrl + Enter too soon :-)

Something like this:

string s = "1.00";

double d = Convert.ToDouble(s,
System.Globalization.CultureInfo.InvariantCulture);

Ed Kaim said:
The easiest way is to use the Convert.ToDouble method. Something like this:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top