By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,079 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,079 IT Pros & Developers. It's quick & easy.

Controls created on one thread cannot (inoke setup)

P: n/a
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

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

"pmclinn" <pm*****@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.