145
Numeric Type and Mask Are incompatible
posted

I am getting an error when I am trying to set the MaskInput for a NumericType.Double/Decimal. When I create my datasource, I am setting the column as a double object. When I am creating a new row for my datasource (datatable), the application runs the InitializeLayout Event. In the event, I am programmically setting the cell as a NumericType Double and using the following mask: "{double: 10.2:c}".

An error is thrown, basically saying that the numerictype and mask are incompatible. I also tried changing it to a NumericType.Decimal and still get the same error. Why does the error get thrown? I figure its my lack of understanding of masks and numerictype. Can someone explain it a bit. 

What I am trying to achieve is to set the mask based on the number type (integer/decimal/currency/percentage) that is preset in a database. When the setting is for decimal or currency, I want the user to be able see the '.' when typing in the number.

Parents
No Data
Reply
  • 466750
    Suggested Answer
    Offline posted

    HI Peter,

    I tried this out, and I'm not getting an errors or exceptions, but the mask you have here is not working properly.

    I am assuming that your column's DataType is Double and that when you say you are setting the NumericType, you mean the Style property of the column is set to Double.

    When I do that and use your mask, the cells all display blanks. It looks like the problem is the space after the ":' in your mask. If I remove the space, it works fine. Alternatively, you would replace that space with a minus ("-") sign and that works, as well. I think the minus indicates that negative numbers are allowed.

    "{double:10.2:c}"

    "{double:-10.2:c}"

Children
No Data