Results 1 to 7 of 7

Thread: No output from Console.WriteLine

  1. #1

    Thread Starter
    Junior Member El-Phantasmo's Avatar
    Join Date
    Sep 2002
    Posts
    30

    No output from Console.WriteLine

    Ok I have an app that I run from either GUI or console...

    For some reason the following line will NOT output anything

    Console.WriteLine("some stuff")

    I can get console arguments just fine, so it knows its coming from console, but it simply will not output anything.
    I know its in teh right spot because I can call a message box right after the .writeline statement.

    I've also tried Console.Write and although it doesn't matter System.Console.WriteLine and nothing gives me any output at all..

    This doesn't seem like a difficult problem, but I don't get any errors so its a little more difficult to track down the problem.

    I've even put the following line into the code, with no help
    System.Console.SetOut(Console.Out)

    Any ideas?

  2. #2
    Lively Member
    Join Date
    Aug 2001
    Posts
    65
    When you write Console.WriteLine("This Text") it will output the result to the debug window.

    But are you talking about the command console? <MSDOS looking thing> I'll assume thats what you mean, you output text like this

    Console.Out.WriteLine("This Text")

  3. #3

    Thread Starter
    Junior Member El-Phantasmo's Avatar
    Join Date
    Sep 2002
    Posts
    30

    Red face




    Console.Out.WriteLine("To Add a server to the scan list")
    Console.Out.WriteLine("//a ServerName [Domain Name]")
    Console.Out.WriteLine("To Remove a server to the scan list")
    Console.Out.WriteLine("//r ServerName")
    Console.Out.WriteLine("To scan for netstat information on servers")

    and I get nothing

    *sigh* just don't get it

    I've also tried with and w/o the
    'System.Console.SetOut(Console.Out)
    line although I get the idea its not doing anything

    btw, this is running from the compiled version not debug mode.

    --- edit ---

    Works!!
    had to set output to console application
    GUI part of it still seems to work ok.. anybody know what the limitations would be?
    Last edited by El-Phantasmo; Sep 8th, 2002 at 10:24 PM.

  4. #4

    Thread Starter
    Junior Member El-Phantasmo's Avatar
    Join Date
    Sep 2002
    Posts
    30
    ok just found the limitation...
    When I run the application normally it still pops up with command prompt and immediately goes into the GUI...

    SO

    How do I change standard output at runtime?

    Thanks

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    change the compile target from winexe to exe.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6

    Thread Starter
    Junior Member El-Phantasmo's Avatar
    Join Date
    Sep 2002
    Posts
    30
    That's sounding like a compile time deal..

    I just need it to be able to output to console when run from command line, but when you double click on the application I don't want the command prompt opening up first... just open the application. Wouldn't that be something that would require a runtime change?

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    sorry but i dont think you can have it both ways.. At least not to my knowledge.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width