Numericupdown validating

14 Apr

As soon as the validation itself fires, I get a SL white screen with the stack trace below.

Say that the range is from 0 to 100, and the current value (arrived at via the spinner) is 100. The result for me is after I input 200 and click the button, only a messagebox with value 100 is shown. Numeric Up Down controls are the most disgusting controls ever conceived. The trick is to get the textbox embedded within the numeric updown control, and handle its Validating event.Here is the new sample code: EDIT#2 @Carlos_Liu: If you need the entered value to be kept, still there is a trick for doing so: @ the Validating event of the textbox, check the value, if it is not within the range, cancel loosing the focus!Exception: Error HRESULT E_FAIL has been returned from a call to a COM component. Set Value(IManaged Peer Base obj, Dependency Property property, Boolean b) at System.