Controls created on one thread cannot (inoke setup)

  • Thread starter Thread starter pmclinn
  • Start date Start date
P

pmclinn

What is the best way to re-write this code to avoid the
'Controls created on one thread cannot be parented to a control on a
different thread.' error?


Private Sub SendCMTStoCore(ByVal Cmts As String)
Dim threadMillhouseBridge As New
MillhouseCore.ShowCMTSBridge(Cmts, AddressOf FormatReturnCMTSInfo)
Dim threadCMTSScan As New Thread(AddressOf
threadMillhouseBridge.BeginCMTSScan)
threadCMTSScan.Name = intThreadCounterMill.ToString

threadCMTSScan.Start()
intThreadCounterMill += 1
End Sub
 
Create both controls on the same thread? Or, create the controls on the
main process thread; create threads to do whatever work they are supposed to
do and use delegates to invoke methods on the controls.
 
Back
Top