I have a little bug : when I play around of value 10, it still become 11. After it become 11 it decrement with 10 and jump to number 1 directly. how to clean this up?
(when I am at value 10, I go up to 20, then go down back to 10, and when I click to go up again it transform to 11).
(when I am at value 10, I go up to 20, then go down back to 10, and when I click to go up again it transform to 11).
Code:
int lastValue = 0;
private void numericUpDown1_ValueChanged_1(object sender, EventArgs e)
{
if (numericUpDown1.Value < 10)
{ numericUpDown1.Increment = 1; }
else
{ numericUpDown1.Increment = 10; }
if ((numericUpDown1.Value == 10) && (lastValue > 10))
{
numericUpDown1.Increment = 1;
}
lastValue = (int)numericUpDown1.Value;
}