Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
660
XamEditor Nullable(Of Decimal)
posted

I have a class that implements IDataErrorInfo and INotifyPropertyChanged that contains properties that have a one to one relationship with a column in a SQL Server Database Table. In this table I am using Decimal datatypes that allow nulls. My properties is the class have a Type of Nullable(Of Decimal). I also have a mask on the field of "$nnnnnn.nn". I have spent 4 hours trying to figure out why I get the following message when inputting "nothing" into a XamEditor field.

 

"Value '' could not be converted."

 

I have changed from XamCurrencyEditor to XamMaskedEditor with the same result.

I have also implemented a ValueToTextConvert that simply strips the preceding dollar sign off of the String as shown here from the ConvertBack method.

Dim editior As ValueEditor = DirectCast(parameter, ValueEditor)

If value IsNot Nothing AndAlso value.ToString.Contains("$") Then

value = value.ToString.Replace(

 

"$","")

End If

Return Infragistics.Windows.Utilities.ConvertDataValue(value, GetType(Decimal), editior.FormatProvider, editior.Format)

 

I hope I have added enough information to define my issue. Thank you.