Numeric Type and Mask Are incompatible

Answered (Not Verified) This post has 0 verified answers | 1 Reply | 2 Followers Thread's RSS feed.

Peter
Points 145
Replied On: Thu, Oct 12 2017 1:26 PM Reply

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.

  • Post Points: 20

All Replies

Mike Saltzman
Points 466,185
Infragistics Employee
Answered (Not Verified) Replied On: Thu, Oct 12 2017 2:29 PM Reply
Suggested by Mike Saltzman

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}"

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 5
Page 1 of 1 (2 items) | RSS