您的位置:首页 > 其它

线程中如何将数据写入窗体中的文本框?

2008-12-11 21:13 274 查看
private void Form1_Load(object sender, EventArgs e)

{

new System.Threading.Thread(writeText).Start();

}

private delegate void dThread();

private void writeText()

{

if (this.InvokeRequired)

{

this.Invoke(new dThread(writeText));

}

else

{

this.textBox1.Text = "jinjazz";

}

}

偷懒就在线程函数中写一行 CheckForIllegalCrossThreadCalls = false;
正规就用委托.(如1楼)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: