471,338 Members | 1,036 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

double.TryParse method problem

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?
Jul 21 '05 #1
2 2507
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);

On Thu, 12 May 2005 17:04:14 +0200, Nols <No**@discussions.microsoft.com> wrote:
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?


--
Happy coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2
Thanks, you save my day :))
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Nols | last post: by
1 post views Thread by Joachim | last post: by
1 post views Thread by John A Grandy | last post: by
11 posts views Thread by Tina | last post: by
5 posts views Thread by Steffan A. Cline | last post: by
2 posts views Thread by steven | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.