we have a custom datatype object "Money" which is used to represent money values in our application. at the moment we are trying to implement some custom formatting within a grid component however the exception "InvalidCastException" is raised from System.Convert.
the text from the exception is;
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:
please note that our "Money" datatype does implement IConvertible as well as having its own TypeConverter.
How can we overcome this exception?
EDIT: This issue is related to DevExpress XtraGrid "Format Conditions" being evaluated on a column bound to our custom datatype "Money". The Money type can be bound to a column without problem, it only raises an InvalidCastException when a format condition is being evaluated on the column, i.e. GridColumnValue > 0