I have a .NET 4.5 Windows Forms application where one of the methods takes time to complete (this is the BulkCopy function, which loads a significant amount of data and inserts into SQL).
I would like to use BackgroundWorker and ReportProgress so that the user knows that something is happening. I have made several applications that use this, but they are all in some kind of loop when BackgroundWorker is doing the work, and I can easily ReportProgress inside each step of the loop.
Here I have a problem, because there is no loop, the code steps:
- working start of async
- get data from DB2 into datatable (this takes longer)
- SqlBulkCopy datatable to SQL table
I would need to start reporting progress (although a fake percentage of progress, a fairly simple progress indicator) between steps 1. and 2. and complete reporting after step 3.
Someone had a similar problem / solution, I think I could just display the GIF image and hide it after the work is completed, but I think this will not work as the form freezes (message does not respond).
source
share