Search code examples
c#eventsnumericupdowneventhandler

Is there a numericupdown event for value increasing in c#


I need an event that happens when the up arrow is pressed and another when the down arrow is pressed. is there an event handler for this? all I can find is valuechanged?


Solution

  • Decimal OldValue;
    private void NumericUpDown1_Click(Object sender, EventArgs e) {
    
       if (NumericUpDown1.Value>OldValue)
          {
             ///value increased, handle accordingly
          }
        else if (NumericUpDown1.Value<OldValue)
          {
            ///value decreased, handle accordingly
          }
        else
          {
            return;
          }
     OldValue=NumericUpDown1.Value;
    }