"ok, then ...
you are not understanding me..."

TRUE

An example on how to let your client tell you which thread to run it.  Just remember, 
if you are firing events, the events don't have to run in the UI thread unless the 
client is going to put code in the event to do stuff with controls, so play it safe 
and fire the events in the UI thread using the UIControl.Invoke method.

Public Overloads Sub RetrieveAndLoad(methodparmsGoHere, ByRef UIControl as Control, 
ByVal SameThread As Boolean)
        '       pass parms to class level vars.
        If SameThread Then
            Me.Run(Nothing)
        Else
            Dim Callback As New System.Threading.WaitCallback(AddressOf Me.Run)
            System.Threading.ThreadPool.QueueUserWorkItem(Callback)
        End If
    End Sub

Private Sub Run(ByVal State as Object)
'       do stuff using parms that are in Class level vars.
End Sub

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to