7

I have a program that just does Console.WriteLine("abc");

I would like to get that output to be within the visual studio window rather than in a cmd window that pops up.

I have tried what was suggested at this SO link here but it hasn't helped.

I have done File..New...Project..Visual C#.. Windows.. Console Application
enter image description here

And i've gone to debug..options and settings.. then ticked "Redirect all output text to the intermediate window"

enter image description here

enter image description here

None of that helps though!

The command window still appears when I click Start / Hit F5.

Really i'm looking for a cmd window to not appear and output just to be redirected to the output window

enter image description here

enter image description here

enter image description here

ADDED

It has been suggested that I check the Intermediate window (Ctrl-Alt-I)

It is coming up as Blank.

It has been suggested that I Go to project..properties and change the type of the application to a Windows Application.

When I do that, I get no cmd window come up (fine). But I don't see any cmd output in the output window, or the intermediate window. And the intermediate window is empty.

Here is for the case where I have the cmd window coming up (so when the type is set to console)

Notice the output window doesn't have the cmd output, and the intermediate window is empty.

enter image description here

enter image description here

Here is the case for when I have set the type to Windows application so no cmd window comes up

ah I see it in the output window.. I might've had to scroll a bit.. or clear it first to make it clearer. nothing in the intermediate window, but I see in the output window.

enter image description here

Community
  • 1
  • 1
barlop
  • 12,887
  • 8
  • 80
  • 109

2 Answers2

4

In the same question you linked to, there's another answer. You need to change the project from a Console Application to a Windows application, apart from the steps you carried out above.

enter image description here

This causes the output to go to the Output window:

enter image description here

Gigi
  • 28,163
  • 29
  • 106
  • 188
  • I tried that and I then get no cmd window come up and no output in the output window – barlop Aug 02 '14 at 06:44
  • I just tried it, it works. The cmd window doesn't come up (which is what you want) and you can't interact with the application, but you do get output in the output window. – Gigi Aug 02 '14 at 06:45
  • Otherwise if you still want the cmd window use System.Diagnostics.Trace instead of Console.WriteLine – Gigi Aug 02 '14 at 06:45
  • When I change the type to winows application then I get no cmd prompt up(fine), but no cmd output the output window or the intermediate window. And the intermediate window is empty. – barlop Aug 02 '14 at 06:47
  • I'm not sure what you're doing wrong. Make sure you've ticked the Redirect to Immediate Window option, and changed the project type. It works like this - I've just added a screenshot to my answer. Check that the "Show output from" dropdown is set to Debug. – Gigi Aug 02 '14 at 06:52
  • Right, that's it - you're looking at the immediate window, not the Output window. – Gigi Aug 02 '14 at 06:53
  • thanks.. funny I can't get it to redirect to the intermediate window though given that I checked that box but anyhow.. yep I see it now in the output window, thanks. I guess I was expecting it to be at the bottom of the output window. – barlop Aug 02 '14 at 07:02
  • That option is pretty misleading (it says that it redirects to immediate window, but it doesn't), and I'd like to know why it works that way. – Gigi Aug 02 '14 at 07:15
0

Try adding a linefeed to the string with \n. This typically happens when you don't add line feed. Text is stored in a line buffer before actual printing.

That could be different between Console and Visual Studio Window?

Pieter21
  • 1,765
  • 1
  • 10
  • 22
  • The WriteLine puts a \n in there anyway, but I tried adding a \n to the string, and still nothing in the output window, or the intermediate window – barlop Aug 02 '14 at 06:46