Hello
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?Code:Private Sub setTextBackgroundWorkerBtn_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setTextBackgroundWorkerBtn.Click Me.backgroundWorker1.RunWorkerAsync() End Sub Private Sub backgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As RunWorkerCompletedEventArgs) _ Handles backgroundWorker1.RunWorkerCompleted Me.textBox1.Text = "This text was set safely by BackgroundWorker." End Sub
Thank you.




Reply With Quote