线程中如何将数据写入窗体中的文本框?
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楼)
{
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楼)
相关文章推荐
- MFC如何自定义消息与在线程中向主窗体控件发送数据
- vc如何自定义消息与在线程中向主窗体控件发送数据
- vc如何自定义消息与在线程中向主窗体控件发送数据
- 如何获取自增长列(标识列)的ID,并写入另一张表(多对多关系插入数据示例)
- 如何跨越线程调用窗体上的控件
- 如何在子线程中操作窗体上的控件 线程间操作无效
- ASP.NET如何在窗体和窗体之间传送数据
- logstash如何将kakfa合并的数据拆分然后写入ES
- 我的尝试:如何启动多线程,后台线程如何向主线程传递数据!
- c#中如何跨线程调用windows窗体控件?
- WPF:如何在工作线程中更新窗体的UI元素(Dispatcher机制)
- uboot烧写yaffs2过程中,如何写入oob数据的 (转)
- MATLAB: 如何读取txt中的文件 如何将数据批量写入数据 文件名递增
- c#如何跨越线程调用窗体上的控件 GOOD
- 如何跨越线程调用窗体上的控件
- 在C#中主线程和子线程如何实现互相传递数据
- 窗体和线程漫谈之工作线程怎样将数据的处理结果显示到窗体
- 如何在线程中创建可以响应事件的窗体
- 子线程如何获取和设置 或者控制窗口实时显示数据(网上的资料经个人整理拼凑总结)
- 具有自动截断功能的函数:对比:strcpy、strncpy、sprintf、snprintf在写入的数据大于缓冲区的情况下如何处理