Edit

Share via


RegularExpressionAttribute.FormatErrorMessage(String) Method

Definition

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