Autometically Fire the Event for Export to Excel

  1. while (true)   
  2. {  
  3.     try   
  4.     {  
  5.         long ScheduleDateTime = ConvertToUnixEpoch(Convert.ToDateTime(txtSchedule.Text));  
  6.         long datetimesystem = ConvertToUnixEpoch(DateTime.Now);  
  7.         if (datetimesystem == ScheduleDateTime)   
  8.         {  
  9.             SearchBounceBackHistory();  
  10.             ExportExcel(txtExportFileName.Text);  
  11.             break;  
  12.         }  
  13.     }   
  14.     catch (Exception ex)   
  15.     {  
  16.         SearchBounceBackHistory();  
  17.         ExportExcel(txtExportFileName.Text);  
  18.     }