Hi cloud of wisdom :-)
I am facing some trouble trying to configure a particular configuration for a NumericUpDown control in c#.
Basically, I have seen that I can set the Increment interval, but I would like to manage the Increment interval depending on which arrow is clicked (up or down). I have checked the events of the control, but I do not find an event for each arrow.
Basically, I want to achieve a control where, at different values, the increment is different.
from 0.00 to 5.00 increments of 0.01, from 5.00 to 20.00 increments of 0.04, and so on
Is this possible ?
Note: It would be useful also an historic value in the control for the last value when the valuechanged event is trigger. Does this exist?
Thanks in advance for any comment or suggestion!!!
EDIT: I edit this, because I did not explained it correctly, I guess. Here it is the reason because I would like to know which arrow was pressed, up or down.
This what I do have, more or less. I have added all the ranges, and some checkings using Modulo division to avoid incorrect values set directly in the value field using the keyboard instead of the arrows. The problem is, if I use arrow up to pass through a limit, everything is OK. However, if I use the arrow down, I miss one step.
if (cuotaUno.Value >= 30M && cuotaUno.Value < 50M)
{
cuotaUno.Increment = 2M;
if (!((cuotaUno.Value % 2M) == 0))
{
cuotaUno.Value = cuotaUno.Value - (cuotaUno.Value % 2M);
}
}
if (cuotaUno.Value >= 50M && cuotaUno.Value < 100M)
{
cuotaUno.Increment = 5M;
if (!((cuotaUno.Value % 5M) == 0))
{
cuotaUno.Value = cuotaUno.Value - (cuotaUno.Value % 5M);
}
}
In this case, If the value is 100 and I click down, it goes directly to 90 instead of 95. But, If I am at 90 and I click up, it goes to 95 and 100 correctly.