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]
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
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.
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,