we have our own object of the "Money" data type, which is used to represent monetary values in our application. at the moment we are trying to implement some custom formatting in the grid component, however, the exception "InvalidCastException" arises from System.Convert.
text from the exception:
System.InvalidCastException occurred
Message="Invalid cast from 'System.Int32' to 'System.Money'."
Source="mscorlib"
StackTrace: at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
InnerException:
note that our Money data type implements IConvertible and also has its own TypeConverter.
How can we overcome this exception?
EDIT: This issue is related to the DevExpress XtraGrid Formatting Conditions, which are evaluated on the column associated with our custom Money data type. The Money type can be attached to the column without problems, it raises only an InvalidCastException when a format condition is evaluated in the column, i.e. GridColumnValue> 0
source
share