Normally controls are created at the main thread.
Is it possible to create some of the child controls in another thread?
Normally controls are created at the main thread. Is it possible to create some
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
tl,dr Don’t do it.
The controls can be created on a different thread, however, when they are added to the parent (created on a different thread),
then there will likely bea cross-thread exception raised. I am not sure if this exception is “guaranteed”, but don’t do it. (There are cross-thread exceptions instead of implicit marshaling for a reason; better to die fast than deadlock later.)Cross-threading and [winform] controls don’t mix. Of course, if different forms are on different threads, and each form’s children are on the same thread as the form, and cross-thread access is guarded or used via “invoke” or similar … but a form isn’t a “child” control.
Happy coding.
Sample cross-thread exception message: