[C#] Get data from the Recording console

[C#] Get data from the Recording console

Hi everyone, today Hung VB was wandering around the internet this morning and saw this article. It's also quite interesting about the very interesting trick to get data from Console Write, so I wrote an article to share it with everyone. :D

In Winform application programming, you often use Console.Write to output data for us to test (log).
And the wish is that I want to display that log from Console.Write() into the Winform TextBox.

To do this, you first add a class: TextBoxStreamWriter.cs

Source : https://pastebin.com/DMYyjwYA

Next in FormConsole.cs you use the following.

Source : https://pastebin.com/r6EtkktL

And now in any form that outputs Console.Write, this FormConsole will display that data on the textbox. So it's done.

Hi everyone, because Hung's time is too limited, I can't release DEMO and VIDEO for you.
Wish you success with this simple and pretty cool trick.

Nguồn : https://m-hungcoder.blogspot.com/2021/01/c-lay-du-lieu-tu-console-write.html

DMCA.com Protection Status