这是我的示例代码:
//------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
从另一个类函数中频繁更新我的状态?