Groups | Blog | Home
all groups > dotnet windows forms > january 2007 >

dotnet windows forms : RunWorkerCompleted call from worker thread in VB CCW


Dicky
1/28/2007 10:20:00 PM
I have a .net library with backgroundWorker object, and it is working fine in
..net environment. Then I exposes the library to VB application to call. Using
standard Callable COM Wrapper (CCW) method, the method can be called, but I
notice that backgroundWorker_RunWorkerCompleted() method will be called from
worker thread, instead of the main thread. And eventually throw exception in
my side as some UI are updated in RunWorkerCompleted method.

Ciaran O''Donnell
1/29/2007 5:01:01 AM
You need to use the Control.InvokeRequired property to check whether you are
on the UI thread and if not (true from prop), call invoke.

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com


[quoted text, click to view]
AddThis Social Bookmark Button