Search code examples
c#.netwinformsnumericupdown

How does one control what numericUpDown displays, 1 and not 1,0, while keeping 0,5 percision?


I have configured my numericUpDown control to have 0,5 precision. (from 0 to 10.)

-changed decimalplaces to 1
-changed increment to 0,5
-maximum at 10
-minimum at 0

When the value is incremented, I see:

0,0
0,5
1,0
1,5
...
10,0

What I want is:

0
0,5
1
1,5
...
10

Is there any simple way to do this? Thank you.


Solution

  • Can you Handle in the ValueChanged event and change the DecimalPlaces property to compare when you value is rounded value.