The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
.NET Core 3.0+
Row

DataValidation.ErrorMessage Property

Gets or sets the message displayed in the error dialog invoked when data validation fails.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.2.Core.dll

Declaration

string ErrorMessage { get; set; }
Property ErrorMessage As String
string ErrorMessage { get; set; }
Property ErrorMessage As String
string ErrorMessage { get; set; }
Property ErrorMessage As String

Property Value

Type Description
String

A string that is the text of the dialog.

Property Value

Type Description
String

A string that is the text of the dialog.

Property Value

Type Description
String

A string that is the text of the dialog.

Examples

The following code snippet adds a new data validation rule and customizes the error dialog invoked when validation fails for the user's input.

The customized dialog is shown in the image below.

DataValidation_ShowErrorMessage

workbook.LoadDocument("Documents\\DataValidation.xlsx");
Worksheet worksheet = workbook.Worksheets[0];

// Restrict data entry to a 5-digit number.
DataValidation validation = worksheet.DataValidations.Add(worksheet["B4:B11"], DataValidationType.Custom, "=AND(ISNUMBER(B4),LEN(B4)=5)");

// Show error message.
validation.ErrorTitle = "Wrong Employee Id";
validation.ErrorMessage = "The value you entered is not valid. Use 5-digit number for the employee ID.";
validation.ErrorStyle = DataValidationErrorStyle.Information;
validation.ShowErrorMessage = true;

// Highlight data validation ranges.
int[] MyColorScheme = new int[] { 0xFFC4C4, 0xFFD9D9, 0xFFF6F6, 0xFFECEC, 0xE9D3D3 };
for (int i = 0; i < worksheet.DataValidations.Count; i++)
{
    worksheet.DataValidations[i].Range.FillColor = Color.FromArgb(MyColorScheme[i]);
}
See Also