I'm rather new to programming.
I've read two VB Express books and everything that I could find concerning Console.Writeline, and yet I still cannot figure out how to view what I write to it.
When I use Debug.Writeline, I can view what I write to it in the "Immediate" window.
I guessed that I should be able to view Console.Writeline in the "Output" window.
Is that correct
I tried things like the example below, and nothing appeared in any of the windows that I looked at:
' System.Console.WriteLine
Imports Microsoft.VisualBasic
Imports System
Public Class TipCalculator
Private Const tipRate As Double = 0.18
Public Shared Sub Main()
System.Environment.ExitCode = Calculator(System.Environment.GetCommandLineArgs())
End Sub
Public Shared Function Calculator(args() As String) As Integer
Dim billTotal As Double
If args.Length < 2 Then
Console.WriteLine("usage: TIPCALC total")
Return 1
Else
Try
billTotal = Double.Parse(args(1))
Catch
Console.WriteLine("usage: TIPCALC total")
Return 1
End Try
Dim tip As Double = billTotal * tipRate
Console.WriteLine()
Console.WriteLine("Bill total:" & vbTab & "{0,8:c}", billTotal)
Console.WriteLine("Tip total/rate:" & vbTab & "{0,8:c} ({1:p1})", tip, tipRate)
Console.WriteLine("".PadRight(24, "-"c))
Console.WriteLine("Grand total:" & vbTab & "{0,8:c}", billTotal + tip)
Return 0
End If
End Function 'Main
End Class 'TipCalculator
'Example Output:
'---------------
'
'Bill total: $52.23
'Tip total/rate: $9.40 (18.0 %)
'------------------------
'Grand total: $61.63
I'm probably going to kick myself when you tell me the answer, aren't I
Thanks for the help.
-Nick-

How do I view Console.Writeline?
twistedinferno
Console.Writeline would output the text in the Console or Command Window (DOS type). You must use the Debug.Write to send text to the output window.
cheers,
Paul June A. Domag
Corey Wirun
Put this in the sub main() section of your module:
Dim
x As Integer For x = 1 To 10000Console.WriteLine(
"hello there") NextIt should open the console window long enough for you to view the ouput.
Robert Campbell
mhammingh
Thanks for the help, guys!
(^,^)
I just have one question for Paul...
I tried using the debug.write method that you told me about like this:
Class Form1
End Class
Oddly, it's saying "Hello World" in the "Immediate" box, and not the "Output" box.
Is this supposed to happen
If so, what's the point of the "Output" box
Michael Boehm
Here is a post on this:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=163326&SiteId=1
Omar Khan
I tried using the console, instead of a windows application, but I still can't seem to find where I can view "the standard output stream".
Am I correct in thinking that it should be viewed in the "Output" window
I tried this code:
Does that seem like it should work
Maorik
hi,
i guess the problem is this , the console is faster than what your eyes can see , it open and write all lines and find nothing else to do so it close, to keep it open add this to the end of your process
Console.ReadLine()
i guess your problem in that line because it suppose to perform your operation durig exist your process so you will not see it
System.Environment.ExitCode = Calculator(System.Environment.GetCommandLineArgs())
try it this way
Public Sub Main() Dim billTotal As DoubleConsole.WriteLine(
" what is the bill total ")billTotal = Console.ReadLine()
Dim tip As Double = billTotal * tipRateConsole.WriteLine()
Console.WriteLine(
"Bill total:" & vbTab & "{0,8:c}", billTotal)Console.WriteLine(
"Tip total/rate:" & vbTab & "{0,8:c} ({1:p1})", tip, tipRate)Console.WriteLine(
"".PadRight(24, "-"c))Console.WriteLine(
"Grand total:" & vbTab & "{0,8:c}", billTotal + tip)Console.ReadLine()
End Subhope it was helpfull