Callback running on wrong thread

  • Thread starter Thread starter swartzbill2000
  • Start date Start date
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
 
If you are calling back to a UI element you can use Control.Invoke method to
callback to the primary thread.
 
Back
Top