Console

I have a fast question.

I want to write text to a dos box for debugging. I have tried to use the Console.write method but it does not do anything.

I have looked at code examples on this website and it seems to use it at will, ie: you don't have to turn it on or anything.

Do I have to turn the console box feature on in .net 2005? If so, how do I do that?

Thanks

[372 byte] By [dayrinni] at [2007-12-25]
# 1
Visual studio 2005 will redirect console.write to the output window when you are running a windows forms application.
KenTucker at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2

you can launch automatically a command prompt Window where you can redirect the outputs and inputs from (Console.Write etc...)

To do this, right click on your project in solution explorer and go to properties

look for something like "Output type" and change from Windows Application to Console Application.

This will now launch an command prompt (MSDOS) Windows for your application which any Console operations can be read/written to, as if it were a Console application. It will of course still launch your GUI Application since its still a Winforms based application

ahmedilyas at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
Alternatively (and this is the approach I take in my own programs):

Use Debug.WriteLine() to write all your diagnostic output. And then either run your program under the Visual Studio debugger OR run the totally excellent DebugView tool from SysInternals:

http://www.sysinternals.com/Utilities/DebugView.html

Note: Debug.WriteLine() only outputs stuff for debug builds of the program. Use Trace.WriteLine() if you want to output stuff for the release build too.

MatthewWatson at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 4

Make sure your Command Window is visible in Visual Studio which shows this Sonsole.WriteLine's statement in Windows Application:

To view it Follow Menu navigation:

View - > Other Windows -> Command Window

or Use Shortcut to it

Ctrl + W, A

Best Regards,

RizwanSharp at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 5
hi,

Just see the namespace System.Diagonistics .

use System.Diagonistics.Debug.Print(string) method.

avikhinvasara at 2007-8-31 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified