This documentation is archived and is not being maintained.

ValidationAttribute.FormatErrorMessage Method

Applies formatting to an error message based on the data field where the error occurred.

Namespace:  System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

'Declaration
Public Overridable Function FormatErrorMessage ( _
	name As String _
) As String
'Usage
Dim instance As ValidationAttribute 
Dim name As String 
Dim returnValue As String 

returnValue = instance.FormatErrorMessage(name)

Parameters

name
Type: System.String

The name of the data field where the error occurred.

Return Value

Type: System.String
An instance of the formatted error message.

This method formats an error message using the ErrorMessageString property. The error is evaluated every time this method is called. This method appends the name of the data field that triggered the error to the formatted error message to indicate the data field that triggered the error. You can customize how the error message is formatted by creating a derived class that overrides this method.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5 SP1
Show: