Home > Net >  About using the card interface across threads call control problem that caused problems of two kinds
About using the card interface across threads call control problem that caused problems of two kinds

Time:09-19

Thread objThread=new Thread (new ThreadStart (delegate
{


Invoke (new Action (()=& gt;
{
List Ls=GetLs698 (str2);
If (ls. Count & gt; 0)
{
For (int I=0; I & lt; Ls. Count; I++)
{
Txt_Reasult. AppendText (ls [I]);//this position will take longer
}
}

}));


}));
ObjThread. IsBackground=false;
ObjThread. Start ();

You where is the great god this problem so that you can perform but card interface

If it's not Invoke,
Thread objThread=new Thread (new ThreadStart (delegate
{

List Ls=GetLs698 (str2);
If (ls. Count & gt; 0)
{
For (int I=0; I & lt; Ls. Count; I++)
{
Txt_Reasult. AppendText (ls [I]);//this position will take longer
}
}

}));
ObjThread. IsBackground=false;
ObjThread. Start ();
Form loads is to add
Control. CheckForIllegalCrossThreadCalls=false;

The BuKa interface why thank you

CodePudding user response:

Invoke a synchronization will be executed end, you would like to use the begininvoke asynchronous calls,

CodePudding user response:

 

List Ls=GetLs698 (str2);
If (ls. Count & gt; 0)
{
String line=string. Join (" ", ls);
Invoke (new Action (()=& gt;
{
Txt_Reasult. AppendText (line);
}));
}

CodePudding user response:

To use the begininvoke
  •  Tags:  
  • C#
  • Related