Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Row

DataValidation.ErrorStyle Property

Gets or sets the style of the alert dialog window used for data validation.

Namespace: DevExpress.Spreadsheet

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

Declaration

DataValidationErrorStyle ErrorStyle { get; set; }

Property Value

Type Description
DataValidationErrorStyle

A DataValidationErrorStyle enumeration value that specifies the style of error alert.

Example

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]);
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the ErrorStyle property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also