Hello,
I have the following code for casting. I am getting an exception System.InvalidCastException: Specified cast is not valid.
Am I missing something?
vTime is a variable of type TimeSpan
deliveredKWH = Math.Abs(float.Parse(dsMeter.Tables[0].Rows[i]["Delivered (kWh)"].ToString()) - float.Parse(dsMeter.Tables[0].Rows[i + 1]["Delivered (kWh)"].ToString()));
iTime = Convert.ToInt32(Math.Abs(vTime.TotalMinutes));