Syncfusion.XlsIO.Base
Example 


SecondDateTime Property

Gets or sets second formula's DateTime value. SecondDateTime must important to validate data in CompareOperator property.
Syntax
'Declaration
 
Property SecondDateTime As Date
'Usage
 
Dim instance As IDataValidation
Dim value As Date
 
instance.SecondDateTime = value
 
value = instance.SecondDateTime
DateTime SecondDateTime {get; set;}
Remarks
Value of the property must be a DateTime. To know more about SecondDateTime property refer this link.
Example
The following code illustrates the use of SecondDateTime property.
using Syncfusion.XlsIO;
using System.Drawing;
using System;
            
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["E1"].Text = "Enter the Date in E3";
           worksheet.Range["E1"].AutofitColumns();
           worksheet.Range["E3"].CellStyle.Color = Color.LightGray;
            
           // DataValidation in Worksheet Range
           IDataValidation dateValidation = worksheet.Range["E3"].DataValidation;
           dateValidation.AllowType = ExcelDataType.Date;
           dateValidation.CompareOperator = ExcelDataValidationComparisonOperator.Between;
           dateValidation.FirstDateTime = new DateTime(2003, 5, 10); 
           dateValidation.SecondDateTime = new DateTime(2004, 5, 10); // SecondDateTime Formula sample value.
           dateValidation.ShowErrorBox = true;
           dateValidation.ErrorBoxText = "Enter Value between 10/5/2003 to 10/5/2004";
           dateValidation.ErrorBoxTitle = "ERROR";
           dateValidation.PromptBoxText = "Data validation for date";
           dateValidation.ShowPromptBox = true;
           workbook.SaveAs("DataValidation.xlsx");
           workbook.Close();
           excelEngine.Dispose();
        }
     }
 }
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also