Home > Net >  Listbox. Invoke an error, not include the definition of the invoke listbox
Listbox. Invoke an error, not include the definition of the invoke listbox

Time:04-19

Bool isOpen=true;
Void ListenConnectSocket ()
{
While (isOpen)
{
Try
{
The Socket ClientSocket=serverSocket. The Accept ();
Byte [] buffer=Encoding. The Default. GetBytes (" to connect to the server success!" );
ClientSocket. Send (buffer);
String client=ClientSocket. RemoteEndPoint. ToString ();
ListBox1. Invoke (new Action ((MSG)=& gt;
{
ListBox1. Items. The Add (DateTime. Now + ":" + MSG);
}), the client);

Thread THR=new Thread (ReceiveCkientMsg);
THR. IsBackground=true;
THR. Start (ClientSocket);
}
The catch (Exception ex)
{
ListenThread. Abort (ex. Message);
}
}
}

CodePudding user response:

With the form, the form of invoke
  •  Tags:  
  • C#
  • Related