0

I am making a GUI to a bigger program. In order to include a Abort button, i had to use Backgroundworker.

void _oWorker_DoWork(object sender, DoWorkEventArgs e)
        {           
            try
            {
                Starter.Handling(cBLog, cBSelC, cBSelT);
                if (_oWorker.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message,"Exception Caught:");
            }
        }

Now however I have stumbled upon a bigger problem, not beeing able to access the Textbox which is loaded as follows:

private void Form1_Load(object sender, EventArgs e)
    {
        // Instantiate the writer
        _writer = new TextBoxStreamWriter(txtConsole);
        // Redirect the out Console stream
        Console.SetOut(_writer);
    }

The Problem is, the TextBox has to stay the Console Output since I don't want to change the subprograms (which also contain while loops). Any suggestions?

Flomax
  • 1

0 Answers0