Link to home
Start Free TrialLog in
Avatar of EAK31640GW
EAK31640GW

asked on

String To double conversion...

I am trying to convert a String type of an engineering value to double. i.e. 1.1234E12
Every time I try an sort of conversion whether it be using Convert.ToDouble or Double.Parse I've tried it using System.Globalization.CultureInfo.InvariantCulture. So far nothing.... I keep getting the error 'System.FormatException'

Here is some code.
//configMessage.coeff[] is a Double
//txtCoeff[] is an array of textboxes where the user has input Double precision floating point numbers which can be of various formats. 1234.123463; 12; 1.2345E12;                 
     
configMessage.coeff[i] = Convert.ToDouble(uiControl.GetText(txtCoeff[i]),System.Globalization.CultureInfo.InvariantCulture);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of ToddBeaulieu
ToddBeaulieu
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of EAK31640GW
EAK31640GW

ASKER

Sorry guys! Thanks so much for the posts!!!
Realized that the problems resided in what I was displaying in text boxes in the first place. My format string was incorrect. I had "0.0###+E0#" instead of "0.0###E+0#"