Problem in numerical update in C #

I am using numerical update in my form,

there, if I change the value that the event should raise (for example: if I change the value from 6 to 7 in a numerical update, the event should raise) I used the ValueChange event to do this, but this event only gets raised if the value changes on wheels mouse or spinbaunt. if I enter a value for a numerical update using the keyboard, this event does not raise.

+4
source share
2 answers

Try using the KeyPress event.

0
source

according to MSDN:

For the ValueChanged event, the Value property can be changed in the code by clicking up or down or by a user entering a new value that is read by the control. the new value is read when the user presses the ENTER key or the transition from control. If the user enters a new one and then presses up or down, the ValueChanged event will occur twice.

Therefore, the user needs to press Enter, if this is not an option to use the KeyPress event

Or TextChanged event, but there is a disclaimer

This event supports the .NET Framework infrastructure and is not used directly from your code.

+2
source

Source: https://habr.com/ru/post/1303226/


All Articles