Callback running on wrong thread

S

swartzbill2000

Hello,
From the following location:

MSDN Home > MSDN Library > .NET Development > .NET Framework SDK >
..NET Framework > Programming with the .NET Framework > Threading >
Using Threads and Threading

I copied the VB.Net code for 'Retrieving Data With Callback Methods'.
Using Thread.CurrentThread.ManagedThreadId and Debug.Print, I see that
the Callback method runs on the worker thread, not the main thread. Is
there a simple way to get a Callback method to run on the main thread?
I am transitioning from a VB6/VC6/ATL background.
Bill
 
G

Guest

If you are calling back to a UI element you can use Control.Invoke method to
callback to the primary thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top