The Inter-thread operation is invalid: It is never accessed by the thread that creates the control.
I heard that 2003 won't. I don't know if this is the case. I 've been using it for a long time ~
This problem may occur in 05, which seems to be for security ~
Oh, now we know two solutions ~
First:Control. checkforillegalcrossthreadcils= False;
When the thread starts, add this sentence. OK. No error is found ~
Everything can be used ~
Second:
With delegation, in 05, each control has an invokerequired attribute ~
Check whether it is true. If yes, the invoke operation is complete ~
// Create a delegate
Private Delegate String Returnstrdelegate ();
// The simplest drop-Value Method ~
Private String Returnschool ()
{
ReturnCb_school.selectedvalue.tostring ();
}
// Determine whether to use invoke drops ~ If not, return directly. ~
Private String Returncb (returnstrdelegate mydelegate)
{
If ( This . Invokerequired)
{
Return(String)This. Invoke (mydelegate );
}
Else
{
ReturnMydelegate ();
}
}
// Call other threads. ~
String _ School = Returncb (returnschool );
This is probably the case. It seems that I have heard that it is best not to use the first method. I don't know why ~
I have always used delegation, which is not very troublesome ~
Please give me a clear explanation. Thank you ~