G
Guest
Is there a way in .NET framework to check which thread a particular windows forms control was created on?
I want to check that a particular control was created on the same thread as my main form, from another arbitrary thread.
I know the "InvokeRequired" property, but I need to marshall the control as a parameter to a method on the main form's thread, and I want to check the thread is OK before I marshall it using myMainForm.Invoke() - as this seems to hang if the control is created on the "wrong" thread.
I want to check that a particular control was created on the same thread as my main form, from another arbitrary thread.
I know the "InvokeRequired" property, but I need to marshall the control as a parameter to a method on the main form's thread, and I want to check the thread is OK before I marshall it using myMainForm.Invoke() - as this seems to hang if the control is created on the "wrong" thread.