I made a very basic scripting language, and in my language there is a command called print – or in other words – print _k should somehow show _k to the user.
I was using MessageBox.Show till now but I also want to include a debugger for my language and for other reasons, I want to use a Stream or something like it.
Basically, on the main form I wanna have a TextBox or something that is somehow connected to a Stream, and when (in script, on a different thread) print something is called it will raise an event on my form that will write something on my TextBox.
I used to overcome this problem by sending the TextBox object as a parameter, but I want to make it more dynamic (so I could read data in more ways than TexBox).
Unfortunately, Stream doesn’t have any events I can use.
Maybe there is another dynamic way?
This might help you out:
http://saezndaree.wordpress.com/2009/03/29/how-to-redirect-the-consoles-output-to-a-textbox-in-c/