Example #1
0
        //recommend reading:
        // How to: Make Thread-Safe Calls to Windows Forms Controls
        // https://docs.microsoft.com/en-us/dotnet/framework/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls

        private void WriteOutput(string text)
        {
            if (this.Output1.InvokeRequired)
            {
                StringArgReturningVoidDelegate d = new StringArgReturningVoidDelegate(WriteOutput);
                this.Invoke(d, new object[] { text });
            }
            else
            {
                Output1.Text = Output1.Text + text + "\n---------------\n";

                Output1.SelectionStart = Output1.Text.Length;
                Output1.ScrollToCaret();
            }
        }