Make your own method for using WriteLine with a textbox...
Textboxes are object with a property Text...
richTextBox1.Text = "new text for the box!"
What I did in my proxy Paradise Example was something like...
Code:
public void OutputLine(string text)
{
this.Invoke(new MethodInvoker(delegate { List<string> lines = packetsOut.Lines.ToList(); lines.Insert(0, text); if (lines.Count > 100) lines.RemoveAt(100); packetsOut.Lines = lines.ToArray(); packetsOut.Refresh(); }));
}
It's messy but basically here's what I'm doing...
I create a list of all lines currently in the textbox (I do this because of the handy dandy list functions... you could do it in far 'better' ways... I used this because it's dead simple)
Ok so we now have a list of all of our lines. We want to add a new line? Well insert it at the START of the textbox (so newest line always is at top. If you want it always at bottom like a normal console... well you can sort out the scrolling yourself xD)
So... lines.Insert(0, text);
This adds our new text at the begining of the list.
Wait... what if the list is too long? Well... simply RemoveAt(maximumNumberOfLines) to keep it trimmed down.
Now that we have all of our lines... simply set the textbox text. Only slight issue there is it operates using arrays (we could have used arrays but then you have to write your own array functions.
textbox.Lines = lines.ToArray();
Tada! I also have the refresh there but I don't recall if it's needed.
The use of delegates I seem to remember having to do with cross thread issues when dealing with winforms but I honestly don't remember.
I generally don't go anywhere near winform and my experience is essentially single threaded, simple winform programs where nothing really matters, console applications or XNA where you have to design your own GUI library anyways lol.