Syncfusion.XlsIO.Base
Example 


FirstDateTime Property

Gets or sets the first formula's DateTime value. FirstDateTime must important to validate data in CompareOperator property.
Syntax
'Declaration
 
Property FirstDateTime As Date
'Usage
 
Dim instance As IDataValidation
Dim value As Date
 
instance.FirstDateTime = value
 
value = instance.FirstDateTime
DateTime FirstDateTime {get; set;}
Remarks
Value of the property must be a DateTime. To know more about FirstDateTime property refer this link.
Example
The following code illustrates the use of FirstDateTime 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); // FirstDateTime Formula sample value.
           dateValidation.SecondDateTime = new DateTime(2004, 5, 10);
           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