Controls created on one thread cannot (inoke setup)

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
 
R

Robin Tucker

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.
 

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