The data of the Web Layer control cannot be directly invoked within the thread, and the threads interact with the data, and the delegate
Code:
Using System;
Using System.Collections.Generic;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Linq;
Using System.Text;
Using System.Windows.Forms;
Using System.Threading; Reference namespaces
Namespace WindowsFormsApplication1
{
public partial class Form1:form
{
public delegate void Wdelegate (string str1); Create a delegate
Public Form1 ()
{
InitializeComponent ();
}
private void Form1_Load (object sender, EventArgs e)
{
}
public void DoWork ()//implementation function
{
Wdelegate mi = new wdelegate (updateform);
This. BeginInvoke (MI, new object[] {"I am a text box"});
}
public void UpdateForm (string param1)//method for assigning a value to a text box
{
This. TextBox1.Text = param1;
}
private void Button1_Click (object sender, EventArgs e)
{
Thread thread = new Thread (new ThreadStart (DoWork)); Thread
Thread. Start ();//Starting Thread
}
}
}
C # implements threading internal interaction with interface controls