console.writeline

  • Thread starter Thread starter portroe
  • Start date Start date
P

portroe

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
 
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?
 
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 said:
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).
 
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
 
* portroe said:
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?
 
Back
Top