tags:

views:

93

answers:

2

Hi,

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 for 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.

A: 

Try using the KeyPress event.

thelost
i tried that, it s not working,because,if i press a key it wont trigger, when i press the next key only theevent for previous key will trigger
+2  A: 

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.

PoweRoy
But without pressing that enter itself my event should raise.... this keypress is not effective i tried it...
Users are used to press Enter after entering something. It should be fine.
OregonGhost