Trace the excess value at UpDown



  • There is NumericUpDown, which has the maximum value:

            this.DimCountUpDown.Maximum = new decimal(new int[] {
            10000,
            0,
            0,
            0});
    

    I need to trace when the user leads over 1000,000 from the keyboard and give him the appropriate notice. I'll do it like that.

        private void DimCountUpDown_KeyUp(object sender, KeyEventArgs e)
        {
            if (DimCountUpDown.Value > 10000)
            {
                MessageBox.Show("Значение не должно превышать 10000", "Ошибка ввода");
                DimCountUpDown.Value = 10000;
            }
        }
    

    However, before entering this value (e.g. 10001) is automatically set to a maximum (10000) and the condition does not work accordingly. ♪ ♪



  • The idea is, you're in the middle of a test. DimCountUpDown_KeyUpso you need to shut down the maximum. It's enough to put it in. Maximum more than 10000, e.g. 1,0001. Or to avoid thinking, you can just put as much as possible:

    this.DimCountUpDown.Maximum = decimal.MaxValue;
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2