Syncfusion.XlsIO.Base
Example 


ErrorBoxText Property

Gets or sets the error message in the error dialog. The user being alerted whenever enters an invalid data. The errorbox text can be edit based on the validation.
Syntax
'Declaration
 
Property ErrorBoxText As String
'Usage
 
Dim instance As IDataValidation
Dim value As String
 
instance.ErrorBoxText = value
 
value = instance.ErrorBoxText
string ErrorBoxText {get; set;}
Remarks
The data validation error message will be shown whenever the user enters invalid data. To know more about ErrorBoxText property refer this link.
Example
The following code illustrates the use of ErrorBoxText property.
using Syncfusion.XlsIO;
using System.Drawing;
             
class Example
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
           //Create a worksheet.        
           IApplication application = excelEngine.Excel;
           application.DefaultVersion = ExcelVersion.Excel2013;
           IWorkbook workbook = application.Workbooks.Create(1);
           IWorksheet worksheet = workbook.Worksheets[0];
           worksheet.Range["A2"].CellStyle.Color = Color.LightGray;
           worksheet.Range["C2"].CellStyle.Color = Color.LightGray;
           worksheet.Range["E2"].CellStyle.Color = Color.LightGray;
           worksheet.Range["A1"].Text = "Text Vaidation";
           worksheet.Range["C1"].Text = "Time Vaidation";
           worksheet.Range["E1"].Text = "Number Vaidation";
           worksheet.Range["A1"].AutofitColumns();
           worksheet.Range["C1"].AutofitColumns();
           worksheet.Range["E1"].AutofitColumns();
            
           // Data validation for text length
           IDataValidation dataValidation = worksheet.Range["A2"].DataValidation;
           dataValidation.AllowType = ExcelDataType.TextLength; 
           dataValidation.CompareOperator = ExcelDataValidationComparisonOperator.GreaterOrEqual;
           dataValidation.FirstFormula = "5";
           dataValidation.ShowErrorBox = true; 
           dataValidation.ErrorBoxText = "Text length should be greater than or equal to 5"; //Error message for text length validation
           dataValidation.ErrorBoxTitle = "ERROR";
           dataValidation.ErrorStyle = ExcelErrorStyle.Warning;
            
           // Date Validation for Time 
           IDataValidation dataValidation2 = worksheet.Range["C2"].DataValidation;
           dataValidation2.AllowType = ExcelDataType.Time; 
           dataValidation2.CompareOperator = ExcelDataValidationComparisonOperator.Between;
           dataValidation2.FirstFormula = "10:00";
           dataValidation2.SecondFormula = "12:00";
           dataValidation2.ShowErrorBox = false;
           dataValidation2.ErrorBoxText = "Time between 10:00 and 12:00 'o Clock";  //Error message for time validation
           dataValidation2.ErrorBoxTitle = "ERROR";
           dataValidation2.ErrorStyle = ExcelErrorStyle.Info;
            
           workbook.SaveAs("DataValidation.xlsx");
           workbook.Close();
           excelEngine.Dispose();
        }
     }
 }
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also