Actually you are missing the point here. Do check out the search results from the link given by thatraja.
You have missed an important thing here, the RunWorkerCompleted event.
Basically in the sub bWorker_DoWork, you can calculate the result of the list and your contacts but
you cannot update the UI controls(controls in your form) in the Do_Work. You have to store the results in
e.Result
of the Do_Work.
Suppose you have a ListBox which stores the list, calculate what you wanted to store in the ListBox and then write :
e.Result=list
You cannot update the ListBox in this function, you will receive an error if you do so.
Next step is to use the RunWorkerCompleted event by doing this :
AddHandler(backgroundWorker.RunWorkerCompleted,AddressOf(back_RunWorkerCompleted))
So in the function back_RunWorkerCompleted, you can get the result of the Do_Work using
e.Result
. (e is in the Argument of RunWorkerCompleted).
Then you can update your UI Controls using that Result. So now your ListBox can be updated here with the e.Result.
You can check my blog here :
http://tarundotnet.wordpress.com/2011/03/14/using-backgroundworker-in-wpf-applications/[
^], its in WPF, but i have explained there.
Hope it helped! :)