I want to parse a string for float. And when the string is zero, it will pass 0 (like a float valule).
I performed such a single:
aeVehicle.MSRP = float.Parse((drInvetory["MSRP"] ?? "0").ToString());
Which gave errors:
ERROR MESSAGE : Input string was not in a correct format.
ERROR SOURCE : at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseSingle(String value, NumberStyles options, NumberFormatInfo numfmt)
at System.Single.Parse(String s, NumberStyles style, NumberFormatInfo info)
at System.Single.Parse(String s)
Please suggest the best way to handle this situation.
source
share