【发布时间】:2012-12-26 12:10:56
【问题描述】:
这是我的示例代码:
//------this is just GUI Form which is having RichTextBox (Access declared as Public)
//
public partial class Form1 : Form
{
public void function1()
{
ThreadStart t= function2;
Thread tStart= new Thread(t);
tStart.Start();
}
public void function2()
{
//Calling function3 which is in another class
}
}
//------this is just Class, not GUI Form
class secondClass: Form1
{
public void function3()
{
Form1 f =new Form1();
//Updating the RichTextBox(which is created in Form1 GUI with Public access)
f.richTextBox1.AppendText("sample text");
}
}
我尝试调用richTextBox1 控件,我的代码运行时没有错误,但richtextbox 没有得到更新。
我必须怎么做才能从另一个类函数中频繁更新我在richTextBox 中的状态?
【问题讨论】:
标签: c# multithreading