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

Send output using Console.Write.

P: n/a
Hi,

I'm programming a WinForm application. I would like to
enter commands that will send output that will help me to
locate bugs in the future.

I know that there is a way to send output by using the
Console.Write command. The question is how can I see the
outputs in the client machine ? Is there a specific
programm to do it or Can I use the prompt window ?

With thanks,
Boba.
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Boba" <bo**@boba.com> wrote in message
news:0a****************************@phx.gbl...
Hi,

I'm programming a WinForm application. I would like to
enter commands that will send output that will help me to
locate bugs in the future.

I know that there is a way to send output by using the
Console.Write command. The question is how can I see the
outputs in the client machine ? Is there a specific
programm to do it or Can I use the prompt window ?

With thanks,
Boba.
.


You could take a look at System.Diagnostics.TextWriterTraceListener - it
allows you to dump text to a file. - and can have certain levels set on it.
Nov 13 '05 #2

P: n/a
100
Hi Boba,
If you want to see your logs on the screen during developing you can make
your project "Console Application" in project's Properties|Output Type.This
will open a console window every time you start the project. In this way all
your Console.WriteLine logs will be visible on the screen. You have to make
your application Windows Application again when you compile the release
version, though. I haven't find a way to set "Console Application" for the
debug and "Windows Application" for the release versions of my projects.
Your Console.WriteLine will stay in the release code, though. So the better
idea I beliave is to use System.Diagnostics.Debug.WriteXXX methods. In this
way you can see your lines in VS.NET's Output|Debug, which is not so
comfortable, I think. The big advantage is that debug code will be in your
code only when you compile the debug versions of the project.
If you dislike (like I do) this Output window you can write and register
your own listener. But what I do actually is to set my project as a "Console
Application" and I put the folowing lines in the begining of my Main
function:
#if(DEBUG)

System.Diagnostics.Debug.Listeners.Add(new
System.Diagnostics.TextWriterTraceListener(Console .Out));

#endif
So, now I can see my output in the console window. All you have to do is to
make sure you return back the Application's output type to "Windows
Application" before the release compilation.

HTH
B/rgds
100

"Boba" <bo**@boba.com> wrote in message
news:0a****************************@phx.gbl...
Hi,

I'm programming a WinForm application. I would like to
enter commands that will send output that will help me to
locate bugs in the future.

I know that there is a way to send output by using the
Console.Write command. The question is how can I see the
outputs in the client machine ? Is there a specific
programm to do it or Can I use the prompt window ?

With thanks,
Boba.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.