problem in numerical updown in c#
i am using numerical updown in my form,
there if i change the value itself a event should raise, (eg:if i change the value from 6 to 7 in the numerical updown a event should raise) i used ValueChange event fo开发者_开发知识库r that, but that event is getting raised, only if the value is changing on mousewheel or on spinbutton. if i enter the value on the numerical updown with keyboard, that event is not raising.
according to MSDN:
For the ValueChanged event to occur, the Value property can be changed in code, by clicking the up or down button, or by the user entering a new value that is read by the control. The new value is read when the user hits the ENTER key or navigates away from the control. If the user enters a new value and then clicks the up or down button, the ValueChanged event will occur twice.
Therefore the user needs to press Enter, if that's not an option use the KeyPress Event
Or TextChanged event, but there's a disclaimer
This event supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Try using the KeyPress
event.
精彩评论