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
265
Formatting Currency & Double Values
posted

Hi;

I am writing a financials application and am having some trouble achieving the desired formatting functionality in the grid.

What I am trying to achieve is similar behavior to MS Access, whereby single, double and currency values can be entered with an unlimited number of decimal places when the cell is in edit mode, yet will always display with only two decimal places and include the thousands separator (the currency symbol is not required).  In addition (if possible) I would prefer for there to be no prompt characters when in edit mode.

I have been playing with the Mask properties but can not get the desired result. 

Is there any way to achieve this functionality.

Kind Regards

Dave

  • 469350
    Verified Answer
    Offline posted

    Hi Dave,

    There's no way to do masking without prompt characters or with an unlimited number of entry digits. The whole purposes of a mask is to limit what the user can enter and limiting the number of possible digits they can enter is mandatory for a mask.

    So my advice is not to use a mask.

    The Format property on the grid will handle the display whenever the cell is not in edit mode and have no effect on the cell when in edit mode. The way Format works is the grid calls the ToString method on the cell's Value and passes in the format. So what formats are supported depends on the DataType you are using.

    Here are a couple of links that you may find helpful.

    Standard Numeric Format Strings

    Custom Numeric Format Strings