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
125
Stop Format or maskInput from auto rounding decimals
posted

Hello,

I was wondering if there was a way to stop auto rounding when using the Format or InputMask properties.

For example, I am loading data into an UltraGrid, and without any formatting, it shows as 49.99999910. I would like for it to show 4 decimal places as so: 49.9999, but it keeps getting rounded to 50.0000.

I have tried .Format = "0.0###" and various maskings such as InputMask = "9999.9999" and InputMask = "nnnn.nnnn".

However, setting the InputMask to "####.####" does not round the decimal, but it then forces to user to put values for all 8 placeholders, and that is undesirable.

Is there a way that this can be done? Thank you in advance!

-Tatiana

  • 12480
    Verified Answer
    Offline posted

    Hi Tatiana,

    Rounding is handled automatically by .NET, so there's no way to configure it. My recommendation is to use an unbound column to show a truncated value. I've included a sample of how you can accomplish this.

    Please review the sample and let me know if you have any questions.

    GridFormatRounding.zip