轉載地址:http://blog.csdn.net/yuzelong36/article/details/4028768
//新建一個代理 private delegate void txtHandeler(object obj); //新建一個線程 private void btnNewThread_Click(object sender, EventArgs e) { Thread thread = new Thread(manyThreads); thread.Start(sender); } //具體賦值方法 private void manyThreads(object obj) { //(1)方法(1)錯誤,如果不用(2)方法不能給textBox賦值,因為不是從創建它的線程訪問它; //textBox1.Text = "adfasfd"; //(2)方法(2)正確,用一個代理訪問它,並invoke txtHandeler txthandler = new txtHandeler(evaluateTxt); textBox1.Invoke(txthandler, new object[] { obj }); } private void evaluateTxt(object obj) { textBox1.Text = "new world!"; }