472,993 Members | 3,201 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,993 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 2602
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nols | last post by:
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)
3
by: Clarkie | last post by:
Hi! I have a string that I try to convert into a double Dim dblOrgAmount As Integer Dim sLine as string Dim blnSuccess As Boolean blnSuccess = Double.TryParse(sLine.Substring(65, 15),...
1
by: Joachim | last post by:
When I run double.TryParse("12.01234567890123456789", out value) I only get 12.0123456789012 as result. How can I get double.TryParse to translate more than 13 decimals (if possible)?
1
by: John A Grandy | last post by:
Primitives like Int32 provide a Parse() method , and TryParse() method -- which is very useful. Enum provides a Parse() method, but not a TryParse() method. Other than wrapping the...
11
by: Tina | last post by:
I'm trying to do this: Double myDouble myDouble = (double) myString I have ensured that myString has a valid value i.e. 79.46. But the compiler won't let me do the cast. How can I get the...
6
by: Jay | last post by:
I need to convert from a string a double that is followed by a scaling character (k means *1e3, M=*1e6, etc) then apply the scaling character. Example: "-1.345k #comment" I know roughly how...
5
by: Steffan A. Cline | last post by:
When using this as indicated and trying to set it to accept multiple formats, it bombs out with the error: Overload resolution failed because no accessible 'TryParse' accepts this number of...
9
by: AGP | last post by:
I've been scratching my head for weeks to understand why some code doesnt work for me. here is what i have: dim sVal as string = "13.2401516" dim x as double x = sVal debug.writeline ( x)
2
by: steven | last post by:
Hi Anybody know why there's no TryParse method for a string type? I can do the following when trying to convert an object to int: object oTest = 1; int iValue; int.TryParse(oTest, iValue); ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.