By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,127 Members | 1,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,127 IT Pros & Developers. It's quick & easy.

console.writeline

P: n/a
Hi

I am using console.Writeline in my simple program. I do not however see
anything happening in the output window when I debug,

there are also no error messages,

Has anybody a tip on what I may be doing wrong,

thanks

portroe

Nov 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
If you want to display something in the output window, you can try the
System.Diagnostics.Debug.WriteLine() method. I think the Console.WriteLine()
method is meant for Console applications (not Windows.Forms), althought it
works on my machine.

Is your test app. a Console or Windows.Forms application?

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"portroe" <bo*@sleigh.com> schreef in bericht
news:uG**************@TK2MSFTNGP11.phx.gbl...
Hi

I am using console.Writeline in my simple program. I do not however see
anything happening in the output window when I debug,

there are also no error messages,

Has anybody a tip on what I may be doing wrong,

thanks

portroe

Nov 20 '05 #2

P: n/a
What kind of application are you writing? Windows Forms or command line?

Console.WriteLine outputs text to the command line when you are running a
Command Line (DOS like) program.

If you want to only output to the Output window within the IDE, Try:

Debug.WriteLine or
Trace.WriteLine

(Both are defined in the System.Diagnostics namespace)

Only use these for debugging puroses. If you are writing a command line
console app, use Console.WriteLine instead.

Hope This helps,

Trev.

"portroe" <bo*@sleigh.com> wrote in message
news:uG**************@TK2MSFTNGP11.phx.gbl...
Hi

I am using console.Writeline in my simple program. I do not however see
anything happening in the output window when I debug,

there are also no error messages,

Has anybody a tip on what I may be doing wrong,

thanks

portroe

Nov 20 '05 #3

P: n/a
* portroe <bo*@sleigh.com> scripsit:
I am using console.Writeline in my simple program. I do not however
see anything happening in the output window when I debug,


Use 'Debug.WriteLine' instead. Or create a project of type "Console
Application" (you can change the type of an application after creating
it in the project properties).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

P: n/a
The Module1 code looks as follows, I have tried changing to debug but to
no avail,

thanks

portroe

Module Module1
Sub Main()
Dim myCar As SportsCar
myCar = New SportsCar()

'Set the horesepower and weight too..

myCar.HorsePower = 240
myCar.weight = 1085

'report the details...
Console.WriteLine("Horsepower:" & myCar.HorsePower)
Console.WriteLine("Weight" & myCar.weight)


'report the number of doors...
Console.WriteLine("The number of doors is:")
Console.WriteLine(mycar.Numberofdoors)

'try and change number of doors to 1000
mycar.Numberofdoors = 1000

'report the number of doors
Console.WriteLine("The number of doors is:")
Console.WriteLine(mycar.Numberofdoors)

'try change number of doors to 2
mycar.Numberofdoors = 2

'report the number of doors
Console.WriteLine("The number of doors is:")
Console.WriteLine(mycar.Numberofdoors)

'Report the speed
Console.WriteLine("The cars speed is:")
Console.WriteLine(mycar.Speed)

'accelerate
mycar.accelerate(5)

'Report the new speed
Console.WriteLine("The Car's speed is Now:")
Console.WriteLine(mycar.Speed)
'set the color property to "Red" ...
mycar.color = "Red"

'show what the value of the property is...
Console.WriteLine("My car is this color:")
Console.WriteLine(mycar.color)

'Display the details of the car...
DisplayCardetails(mycar)

'Wait...
Console.ReadLine()
End Sub
'Displaycardetails - function that displays a car details...
Function DisplayCardetails(ByVal myCar As Car)

'display the details of the car...
Console.WriteLine("Color:" & myCar.Color)
Console.WriteLine("Number of doors:" & mycar.numberofdoors)
Console.WriteLine("Current speed:" & myCar.Speed)
Console.WriteLine()

End Function
End Module
Herfried K. Wagner [MVP] wrote:
* portroe <bo*@sleigh.com> scripsit:
I am using console.Writeline in my simple program. I do not however
see anything happening in the output window when I debug,

Use 'Debug.WriteLine' instead. Or create a project of type "Console
Application" (you can change the type of an application after creating
it in the project properties).


Nov 20 '05 #5

P: n/a
* portroe <bo*@sleigh.com> scripsit:
The Module1 code looks as follows, I have tried changing to debug but
to no avail,


What's the type of the project? Are you sure 'Sub Main' is selected as
startup object in the project properties?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.