Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Console.writeline - No Effect

Status
Not open for further replies.

jake007

Programmer
Jun 19, 2003
166
US
I have the following code on a button1 click event

console.writeline("This is a test")
console.readline()

When I execute the code nothing happens. Why am I not seeing the console? Any Ideas?

Jake
 
No, it is a windows app, but I want to display some debugging info in the console window...

Jake
 
If you have a button you are probably creating a WinForms application that does not have a console. If you are running the code under Visual Studio, you might see the code in the Output window. However if you want to write to the output window you should use System.Diagnostics.Debug.WiteLine or System.Diagnostics.Trace.WiteLine.

You can see the output if you redirect it to a file so running the command

Code:
MyExe.exe > OutputFile.txt

will send all Console.WriteLine output to the OutputFile.txt.


If you want a proper console application you will have to open the project properties and on the Application tab set the Application Type to Console. You will then need to change the code to look something like this:

Code:
Module Module1

    Sub Main()
        Console.WriteLine("message")
        Console.ReadLine()
    End Sub

End Module
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top