In a Windows Form, I need to delegate a lengthy action to a BackgroundWorker so that the main application doesn't freeze.
However, the code in the BackgroundWorker must send data back to the main application. This code from MSDN doesn't include how to do this:
Is there a way for a BackgroundWorker object to send data back to the main app without using a global variable?
Private Sub setTextBackgroundWorkerBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setTextBackgroundWorkerBtn.Click
Private Sub backgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs) _
Me.textBox1.Text = "This text was set safely by BackgroundWorker."