double dVal = 0.0;
String sVal = "1234568.800098"; //simulate user input
try //added incase user input not numeric
{
dVal = Convert.ToDouble(sVal);
//dVal = 1234568.8000979999
}
catch (Exception)
{
dVal = 0.0;
}
//d.dd format (String.Format) not supported in NETMF
mResponseText = dVal.ToString("0.00");
//Get Exception in line above
//Ex='System.ArgumentException' occurred in mscorlib.dll
only if I modify the above to remove the format string, does it stop crashing
mResponseText = dVal.ToString();
But this introduces a value error in the string conversion.
such that the result is “1234568.8000979999” when I only want the display to
show “1234568.80”