G
Guest
hello
i put a richtextbox and a button on the winForm.when the button is clicked,it generate several threads to write to the richtextbox,the code snippet as following:
private void btnSend_Click(object sender, System.EventArgs e)
{
for(int i=0;i<3;i++)
{
Thread thread =new Thread(new ThreadStart(rpt));
thread.Start();
}
}
private void rpt()
{
this.richTextBox1.AppendText("hello world");
}
it throw null reference exception,i wonder how can i write to the richtextbox MULTITHREADINGLY,any code snippet is appreciated.
thank you!
i put a richtextbox and a button on the winForm.when the button is clicked,it generate several threads to write to the richtextbox,the code snippet as following:
private void btnSend_Click(object sender, System.EventArgs e)
{
for(int i=0;i<3;i++)
{
Thread thread =new Thread(new ThreadStart(rpt));
thread.Start();
}
}
private void rpt()
{
this.richTextBox1.AppendText("hello world");
}
it throw null reference exception,i wonder how can i write to the richtextbox MULTITHREADINGLY,any code snippet is appreciated.
thank you!