Ozan Ayten
Ozan Ayten

Reputation: 1473

NumericUpDown ValueChanged event not working on entering values

Event not activates on entering values by using numbers on keyboard. It only activates when you use the up and down arrows. What I want is, It must activate on every keyboard stroke like textbox textchanged event.

I've tried few things but user had to press enter for activating the event. I don't want that.

It must be same like textbox event. Any ideas ? or another tool maybe ?

Upvotes: 4

Views: 4017

Answers (1)

Kurubaran
Kurubaran

Reputation: 8902

NumericUpDown control fires the value changed event in the following scenarios

  • When using Up/Down arrows of the control as you have mentioned.
  • When the control loses focus after changing the value using keyboard input.
  • When using Up/Down arrow keys in the keyboard.

Instead of ValueChanged you can use KeyPress event which fires for every keyboard key stroke.(but keep in mind this event will only fire for keyboard numeric key press)

private void numericUpDown1_KeyPress(object sender, KeyPressEventArgs e)
{

}

Upvotes: 1

Related Questions