officefileapi-devexpress-dot-spreadsheet-dot-datavalidation-9fff1cfb.md
Gets or sets the input message text.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
string InputMessage { get; set; }
Property InputMessage As String
| Type | Description |
|---|---|
| String |
The message text.
|
| Type | Description |
|---|---|
| InvalidOperationException |
Occurs if the message text is longer than 255 characters.
|
The input message appears near a validated cell and explains what data a user can enter in this cell.
Use the DataValidation.ShowInputMessage property to display or hide the input message.
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 input message.
validation.InputTitle = "Employee Id";
validation.InputMessage = "Please enter 5-digit number";
validation.ShowInputMessage = 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]);
}
workbook.LoadDocument("Documents\DataValidation.xlsx")
Dim worksheet As Worksheet = workbook.Worksheets(0)
' Restrict data entry to a 5-digit number
Dim validation As DataValidation = worksheet.DataValidations.Add(worksheet("B4:B11"), DataValidationType.Custom, "=AND(ISNUMBER(B4),LEN(B4)=5)")
' Show input message.
validation.InputTitle = "Employee Id"
validation.InputMessage = "Please enter 5-digit number"
validation.ShowInputMessage = True
' Highlight data validation ranges.
Dim MyColorScheme() As Integer = { &HFFC4C4, &HFFD9D9, &HFFF6F6, &HFFECEC, &HE9D3D3 }
For i As Integer = 0 To worksheet.DataValidations.Count - 1
worksheet.DataValidations(i).Range.FillColor = Color.FromArgb(MyColorScheme(i))
Next i
The following code snippets (auto-collected from DevExpress Examples) contain references to the InputMessage 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.
validation.InputTitle = "Employee Id";
validation.InputMessage = "Please enter 5-digit number";
validation.ShowInputMessage = true;
validation.InputTitle = "Employee Id";
validation.InputMessage = "Please enter 5-digit number";
validation.ShowInputMessage = true;
validation.InputTitle = "Employee Id";
validation.InputMessage = "Please enter 5-digit number";
validation.ShowInputMessage = true;
validation.InputTitle = "Employee Id"
validation.InputMessage = "Please enter 5-digit number"
validation.ShowInputMessage = True
validation.InputTitle = "Employee Id"
validation.InputMessage = "Please enter 5-digit number"
validation.ShowInputMessage = True
See Also