Hi experts,
I have set up control's MaskInput equals "nn", MaxValue equals 99, minValue equals 1.
The issue is when user input single "0", it looks like a valid value for him, but actually the control hold the cursor, which forces user to input another letter. As long as he inputs another letter, say 3, the control is happy with a valid value "03". But users dont know the 1-99 constraint, they click anywhere just after inputing a single 0, and complain why nothing happens.
So my question is is there a way to prohibit user from input a single 0?
Another option would be to use the UltraValidator component. So, don't set MinValue and MaxValue on the MaskedEditor control. Instead, add an UltraValidator component to the form and then go tot he UltraMaskedEditor control's ValidationSettings.
On the ValidationSetting, you would set:
ValidationPropertyName = Text
RetainFocusOnError = true
Condition = a range condition from 1 to 99.
And you may want to set the NotifcationSettings.Caption to something like "Value must be between 1 and 99"
I have attached a small sample project demonstrating this.
Hi,
There's no built-in way for the control to do that. But there are a couple of approaches you could take.
What I would do is give the user a message indicating why what they entered is wrong. You could do this by handling the MaskValidationError event. Something like this:
private void ultraMaskedEdit1_MaskValidationError(object sender, Infragistics.Win.UltraWinMaskedEdit.MaskValidationErrorEventArgs e) { UltraMaskedEdit maskedEditor = (UltraMaskedEdit)sender; if (maskedEditor.Text == "0") { MessageBox.Show(string.Format("Value must be between {0} and {1}", maskedEditor.MinValue, maskedEditor.MaxValue)); } }