I have a long method which calculates invoices from a database, creates a PDF and sends each invoice as an email attachment. At the beginning of this method there is a line “winWait.Show”.
What is the best way to get this window to show sooner rather than later?
Splitting the SHOW away from the actual work will let the Show happen first then in the very short period timer the rest of the work can happen
You can just drop a timer control on the window, set its run mode to OFF and period to 0
Then in the Windows Open event set the run mode to Once and have it run the method that does all the work you mentioned
You could do all this in code but … myeh … six of one half dozen of the other
There are other ways as well but this is about the simplest
Interestingly this problems are coming up with nearly every Desktop language. When multithreading it becomes even more important to really take care. It is also a common error people making not toe control their windows completely what makes it sometimes creapy. We had a customer project where once a year on over 200 workplaces a bug. They have never found out why. When. I rewrote the stuffs I asked them if they had problems with that window cause the timing could go wring and the data in the window are after incorrect