- private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
- {
- _process = new Process();
- _process.StartInfo.FileName = @"//myconsolaeapp";
- _process.StartInfo.UseShellExecute = false;
- _process.EnableRaisingEvents = true;
- _process.StartInfo.CreateNoWindow = true;
- _process.StartInfo.RedirectStandardOutput = true;
- _process.OutputDataReceived += OutputHandler;
-
- _process.SynchronizingObject = richTextBox1;
- _process.SynchronizingObject = richTextBox1;
- _process.Start();
- _process.BeginOutputReadLine();
- _process.WaitForExit();
- }
and other methods
- private void OutputHandler(Object source, DataReceivedEventArgs outLine)
- {
-
- if (!String.IsNullOrEmpty(outLine.Data))
- {
- richTextBox1.AppendText(outLine.Data + "\r\n");
- richTextBox1.ScrollToCaret();
-
- }
- }
I have a textbox that once text is changed it is written to my hidden console window and updated in the tichtextbox1.
Can anybody give me some hints please