- 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楼)
线程中如何将数据写入窗体中的文本框?
最新推荐文章于 2019-05-23 09:56:14 发布