One, cross-process access Components
Error: Invalid inter-thread operation: access it from a thread that is not creating a control "XXX"
Workaround:
1: Set the Checkforillegalcrossthreadcalls to False
This method simply does not catch the call to the wrong thread and does not resolve the problem from the root cause, and the code continues to throw errors that the component is not instantiated.
2: Delegate (recommended)
Directly on the code
public delegate void Myinvoke ();p rivate void Setbtnstatus () { if (ishandlecreated) { Myinvoke mi = new Myinvo Ke (setstatusmethod); BeginInvoke (MI); } else Setstatusmethod ();} public void Setstatusmethod () { btnsave.enable = true;}
Declares a delegate method Myinvoke
ishandlecreated: Gets a value that indicates whether the control has a handle associated with it. If the component is not associated, you can execute the method directly, creating or manipulating the component. The execution method is delegated if there is a relationship.
C # Multithreading Problem integration