
There’s a few methods to ensure that you can present an update to your users regarding progress of any iterative process. Here’s the easiest I’ve found…
I’ve messed around with BackGround workers and Await Async. The problem with the latter is that there are lots of complications around cross-thread calls. Regarding the latter, I got a bit lost in the finer details! Here’s the simplest way I found to achieve the above:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Private Async Sub PrecipitatingEvent(sender As Object, e As EventArgs) Handles Button1.Click Await MethodWrapper() End Sub Private Async Function MethodWrapper() As Task ImgDownloadPB.Value = 0 Await MainMethodDoWork() End Function Private Async Function MainMethodDoWork() As Task For i = 0 To 100 ImgDownloadPB.Value = i Next End Function |
Leave a Reply