I have an object of type Dictionary(Of Int16, Polygon) and which contains sometimes up to 15 or so Polygons that i am creating bitmap files with the Polygon. This can take like 20 seconds sometimes so i was trying to pass the full Dictionary to background worker as an argument but i get an issue when trying to access each individual Polygon inside of the Dictionary because the Polygons still belong to the UI thread. How can I access the Polygons inside the Dictionary with the backgroundworker?


Code:
                    Dim worker As New BackgroundWorker
                    AddHandler worker.DoWork, AddressOf MeasurePolygons
                    AddHandler worker.RunWorkerCompleted, AddressOf WorkerCompleted

                    worker.RunWorkerAsync(PolygonCollection)
that is how im calling the thread. PolygonCollection is the Dictionary(Of Int16, Polygon) that contains all the polygons that i will be creating a bitmap file out of. Thanks to anyway who can provide me with any assistance.