.netvb.netbackgroundworkeraviplaying

Running animation in background worker


I m developing an application in vb 2008, and using background worker to copy file(s). I have my own designed form which plays an animationon on the top of the form along with copy. For playing animation i m using "AxMSComCtl2.AxAnimation", on execution i get

"ActiveX control '' cannot be instantiated because the current thread is not in a single-threaded apartment."

On search i found a link :Forum Link

But still in this link Firstly i dont understand where to insert this snippet and secondly how to implement the idea on background worker.

Please guide me in this regard.

Thanks & Regards,

Maverick.


Solution

  • You need to use a delegate and have the main thread actually control the animation. You invoke the delegate from the background thread but it runs in the main thread. This page, second post, has the rough idea: http://www.vbforums.com/showthread.php?t=377205