Writing to output window of Visual Studio

previous_developer picture previous_developer · Feb 27, 2012 · Viewed 705.9k times · Source

I am trying to write a message to the output window for debugging purposes. I searched for a function like Java's system.out.println(""). I tried Debug.Write, Console.Write, and Trace.Write. It does not give an error, but it does not print anything either.

"Define DEBUG constant" and "Define TRACE constant" options are checked.

Menu ToolsOptionsDebugging"Redirect all Output Window text to the Immediate Window" option is not checked.

Configuration: Active (Debug)

Note: I created a project with the wizard as "Windows Forms Application" if relevant. I have no idea where to look.

Answer

Bhargav Bhat picture Bhargav Bhat · Feb 27, 2012

Add the System.Diagnostics namespace, and then you can use Debug.WriteLine() to quickly print a message to the output window of the IDE. For more details, please refer to these: