private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { this.ProgressText = "Searching for Item Updates..."; List <string> itemIds = ItemService.RetrieveUpdateItemReportItemIds(ReportEndDate, ReportStartDate); int count = 1; foreach (string itemId in itemIds) { int num = count - 1; try { this.Items.Add(ItemService.RetrieveItem(itemId, count)); this.ProgressText = "Retrieving item data for " + count + " of " + itemIds.Count.ToString(); } catch (Exception ex) { ErrorLog.LogError("Failed to Retrieve data for Item " + this.Items[num].ItemId + ".", ex.ToString()); break; } count++; } this.ProgressText = "Writing to excel sheet..."; ExcelService.CreateItemWorkbook("**Item", this.Items, this.FilePath); this.ProgressText = "Report Complete"; this.BackgroundWorkerState = ""; this.BackgroundWorker = new BackgroundWorker(); }