Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- namespace ConsoleRedirection
- {
- public partial class FormConsole : Form
- {
- TextWriter _writer = null;
- public FormConsole()
- {
- InitializeComponent();
- }
- private void FormConsole_Load(object sender, EventArgs e)
- {
- _writer = new TextBoxStreamWriter(txtConsole);
- Console.SetOut(_writer);
- Console.WriteLine("Now redirecting output to the text box");
- }
- private void txtSayHello_Click(object sender, EventArgs e)
- {
- Console.WriteLine("Hello world");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement