Consider the code below for a simple form with a progress bar, a button, and BGW is a BackgroundWorker with Modifiers = Public. This works but if I change blnRunInModule to true it doesnt update. Yet the PerformStep is being executed as is apparent by the Debug.WriteLine showing the value increasing. What am I doing wrong?
vb.net Code:
Public Class Form1 Private Sub Button1_Click() Handles Button1.Click BGW.RunWorkerAsync() End Sub Private Sub BGW_DoWork() Handles BGW.DoWork Dim blnRunInModule As Boolean = False For intCount As Integer = 1 To 10 If blnRunInModule Then Module1.MySub(intCount) Else BGW.ReportProgress(intCount) End If System.Threading.Thread.Sleep(1000) Next End Sub Private Sub BGW_ProgressChanged() Handles BGW.ProgressChanged ProgressBar1.PerformStep() End Sub End Class
vb.net Code:
Module Module1 Sub MySub(intCount As Integer) Form1.BGW.ReportProgress(intCount) End Sub End Module