Hello,I use the UltraNumericEditor (MinValue 1, MaxValue 5).The user can delete the value in the UltraNumericEditor.
Which property I must change, so the the user can not delete the value?
Alexander
Definitely UltraNumericEditor with an UltraValidator on the form. This makes the "ValidationSettings" property appear on the UltraNumericEditor's properties grid, and within that you can set the RetainFocusOnError property. The property is not directly on the numeric editor.
With regard to the event handler, it's now working fine. No idea why, but the event handler that VisualStudio created for the ValidationError event was not specifying the namespace for the args, and was using the wrong args class. It's fine now, problem solved.
Hi,
Are you sure you are using an UltraNumericEditor?
There is no RetainFocusOnError property on UltraNumericEditor. And the event agrs for the ValidationError event are Infragistics.Win.UltraWinEditors.ValidationErrorEventArgs and there is definitely a RetainFocus property on this class.It's not a new property, either. It was always on this class from it's inception back in 2002.
My guess is that you are using another type of control or handling the wrong event.
Hi Mike,
I'm trying to handle the ValidationError, but I've noticed that there is no e.RetainFocus property on the args. This is because there are two error arg classes in different namespaces, but the one that is generated for the ultra validator is from .Misc namespace, not .UltraWinEditor namespace.
I also tried to set the UltraNumericEditor.RetainFocusOnError property to false (via the ultraValidator) but that has no effect.
Seems like I'm missing something obvious here.
Excellent comprehensive answer, thanks Mike.
Hi Boz,
By default, the control will beep when an error occurs.
If that's no enough of an indication of the error, then you can give the user more information in any number of ways.
For example, you could handle the ValidationError event and show a message.
Or you could use this event to apply an appearance to the control, or use an ErrorProvider component.
You can also use this event and set e.RetainFocus to false, if you don't want the control to keep the user from leaving. You could even set the Value on the control back to the last valid value.
Or you could use UltraValidator to handle the appearance and the error message for you.
So you have a lot of control over what happens in this case.