double.TryParse method problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

i need some help (this wan't work)

double outDoubleOrgJed;
string orgJed = "1.0000000E+00"

Double.TryParse(orgJed, System.Globalization.NumberStyles.Float , null, out
outDoubleOrgJed)

fails to create double !!

why?
 
Nols,

The reason it fails is because your culture uses , as decimal point, not .

Use the overload the specifies an IFormatProvider

CultureInfo ci = new CultureInfo("en-US");
Double.TryParse(orgJed, NumberStyles.Float, ci.NumberFormat, out outDoubleOrgJed);
 

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