I’ve written a program that loops through a list from a DB, sets up some tables in the DB, and prints out a PDF of a Crystal Report. While it’s printing, I have a new window pop up that has a label saying what is currently printing and a button to Cancel the job. The problem I’m having is that while the reports are gathering data and printing the report, the pop-up is un-responsive and the cancel button usually doesn’t do anything. Sometimes I get luck and time it right so my code gets called, but I have to jam on the button.
I thought maybe threading was the answer, but I haven’t found a solution that works using that. I have a few DoEvents scattered about, but that’s not really the answer, I know.
Just wondering if anyone might have a solution.
Thanks a bunch
I recommend putting your printing job in another thread.
Display a window popup (modal form) when you program is ready to print. Inside this window popup (OnLoad method) start worker thread e.g using BackGroundWorker class and dismiss this dialog when printing finished or Cancel button is pressed.