private delegate void RichTextBoxUpdateEventHandler(string message);
richTextBox1.Invoke(
new RichTextBoxUpdateEventHandler(UpdateRichTextBox), // the method to call back on
new object[] {message}); // the list of arguments to pass
private void UpdateRichTextBox(string message) {
if (richTextBox1.InvokeRequired) {
// this means we're on the wrong thread!
// use BeginInvoke or Invoke to call back on the
// correct thread.
richTextBox1.Invoke(
new RichTextBoxUpdateEventHandler(UpdateRichTextBox), // the method to call back on
new object[] {message}); // the list of arguments to pass
}
else {
richTextBox1.AppendText(message);
}
}