467,921 Members | 1,336 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,921 developers. It's quick & easy.

console.writeline

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
  • viewed: 11094
Share:
5 Replies
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
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
* 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
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
* 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.

Similar topics

5 posts views Thread by Publicjoe | last post: by
17 posts views Thread by MumboJumbo | last post: by
4 posts views Thread by Bob | last post: by
2 posts views Thread by djc | last post: by
1 post views Thread by John Wright | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.