BackgroundWorker exposes events to coordinate the work. When you call the RunWorkerAsync method, the DoWork event is raised on the thread pool thread. You can pass an optional Argument to the RunWorkerAsync method, which can be retrieved from the DoWorkEventArgs.Argument property inside the DoWork event handler.
As the DoWork event handler executes on a thread pool thread, accessing UI controls inside the DoWork handler will throw Exception. For this reason, pass the value from the UI as an argument to the RunWorkerAsync method.
When the DoWork event handler completes its execution, BackgroundWorker raises the RunWorkerCompleted event. This runs on the UI thread, and thus, you can perform UI operations from this event handler. If you have passed any value from the DoWork handler, you can retrieve it here from the RunWorkerCompletedEventArgs.Result property.