All pastes #560557 Raw Edit

Stuff

public text v1 · immutable
·published 2007-06-12 03:54 UTC
rendered paste body
        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);
            }
        }