RegularExpressionAttribute.FormatErrorMessage(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Formats the error message to display if the regular expression validation fails.
public:
override System::String ^ FormatErrorMessage(System::String ^ name);
public override string FormatErrorMessage (string name);
override this.FormatErrorMessage : string -> string
Public Overrides Function FormatErrorMessage (name As String) As String
Parameters
- name
- String
The name of the field that caused the validation failure.
Returns
The formatted error message.
Exceptions
The current attribute is ill-formed.
The Pattern is not a valid regular expression.
Remarks
The FormatErrorMessage creates the error message by using the name of the data field that caused the validation failure. You can override this method in custom validation attributes to customize how errors are created or to provide a more complex message that contains parameters that you evaluate at run time.
Applies to
.NET