0
Reply

Overflow Exception

praveenreddy

praveenreddy

Apr 26 2005 3:46 AM
1.7k
I'm getting the following error message when i try to convert Float to Int32. Message = Value was either too large or too small for an Int32. Source = mscorlib Method = ToInt32 StackTrace = at System.Convert.ToInt32(Double value) at CheckError(String DataValue) here is the CheckError() method: public static string CheckError(string DataValue) { try { float a=(float)Convert.ToDouble(DataValue); if(a > UniqueErrorCode) { return PIDataValue; } else //Quality check { a = a -(UniqueErrorCode); switch(Convert.ToInt32(a)) { case -313:return "Fail"; case -307:return "Bad"; case -254:return "ShutDown"; default : return "BadData"; } } } catch(Exception ex) { return "Error"; } } Please suggest me to fix this.