By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,873 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

How to show the console contents in a Window Form?

P: 6
Does anybody has any idea how to listen to the console and show its contents in a Windows Form Application?
Dec 16 '08 #1
Share this Question
Share on Google+
7 Replies


Plater
Expert 5K+
P: 7,872
Whos console, yours or another processes?
Dec 16 '08 #2

P: 6
My console!! in the same project.
Dec 16 '08 #3

Plater
Expert 5K+
P: 7,872
Hmm well, everything outputed to your console is put there by you youself in code, so I would say just change your console.writeline's to myTextbox.AppendText()s ?
Dec 16 '08 #4

nukefusion
Expert 100+
P: 221
You could also attach a Listener object to intercept output.
That would save you trawling through your code and adding additional lines to output the data somewhere else.
Dec 16 '08 #5

Frinavale
Expert Mod 5K+
P: 9,731
@nukefusion
Seems a bit over kill because it's his own code that is generating the output in the first place....I would recommend trying Plater's suggestion first before attempting the Listener Object implementation.
Dec 16 '08 #6

nukefusion
Expert 100+
P: 221
@Frinavale
Agreed, if it's only a few lines scattered around a few classes then Platers suggestion would work fine and would definitely be the way to go.

I was thinking more in terms of if it's hundreds of lines of code all over the place. In those circumstances a listener would be much quicker to implement than trawling through existing code - it's fairly simple to setup requiring only a handful of lines of code and only needs to be plugged in once. It's also got the added benefit that once it's set up, it's there. You don't need to remember to add those additional lines in the future either, making it easier to maintain.
I guess it really depends on what you want to do with it long term.
Dec 16 '08 #7

Plater
Expert 5K+
P: 7,872
edit: oops wrong thread
Dec 16 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.