Tim
Tim

Reputation: 8919

DevExpress TextEdit : runtime property that returns boolean whether entered value is valid per EditMask and MaskType?

If you set the MaskType and the EditMask, can the editor return a boolean at runtime indicating whether or not it contains a valid value?

          if (myTextEdit.IsValid) { .... }

or perhaps return an enum indicating the following?

           blank
           valid
           invalid

Upvotes: 0

Views: 971

Answers (1)

Sebi
Sebi

Reputation: 3979

If you set the EditMask, you say what is allowed. So the textedit cant be invalid, because the user just can type values that you declare. The other way is to declare an RegEx at Runtime and test your textEdit input against it, in the validating event of the textEdit. So you can set the Errortext Property of the EventArgs if Match is false. So the user cant leave the textEdit if he type invalid value and he get the hint or error you declare in the e.Errortext Property. Dont forget to set the Errortext Property string.empty in the validated event.

i hope it was helpfull.

Upvotes: 0

Related Questions