How to capture the value change of numericUpDown ctrl real-time in .NET?

Posted by Carlos_Liu on Stack Overflow See other posts from Stack Overflow or by Carlos_Liu
Published on 2010-02-22T07:20:37Z Indexed on 2010/03/13 16:45 UTC
Read the original article Hit count: 220

Filed under:

I have implement the ValueChanged event, but I found it will be triggered only after change the focus from numericUpDown to other control or by clicking the up/down arrow.

Inputting the value in the control will not trigger ValueChanged event.

What I did now is adding an KeyDown event and judge if the input value is numeric (can not include SHIFT/CTRL/ALT key); but there is another case need to be involved: the user can paste value into the numericUpDown ctrl

What I need is :

  1. When I was typing numeric value (only numeric) in the numericUpDown ctrl, it will known the content has been changed;
  2. When pasted a numeric value into the ctrl, it also kowns the content changed

© Stack Overflow or respective owner

Related posts about .NET