Accessing the output from Console.Writeline

  • Thread starter Thread starter Randy
  • Start date Start date
R

Randy

What does Console.Writeline do? I'm going through some exercises in a
book and it uses this command frequently to show the results of code
execution. On my system, nothing happens, however. How do I access
this data?

Thanks,
Randy
 
Randy said:
What does Console.Writeline do? I'm going through some exercises in a
book and it uses this command frequently to show the results of code
execution. On my system, nothing happens, however. How do I access
this data?

Make sure the project type is set to "Console Application". The output will
apear in a console window then.
 
What does Console.Writeline do? I'm going through some exercises in a
book and it uses this command frequently to show the results of code
execution. On my system, nothing happens, however. How do I access
this data?

Thanks,
Randy

Console.Writeline outputs to a command window. your application must
compile to a console app inorder to see this. If you are using one of
the visual studio suites, console apps are listed as a project
template when you create a new project. You can also output to your
immediate window by using debug.writeline in a windows app running
debug mode.
 
Thanks. Sorry to be an idiot, but what is supposed to be the result
of the debug.writeline statement? I changed my code and stepped
through each line. Everything compiles and executes correctly, but
that line seems to have no result. Here is the code - very basic:

Dim strSQL As String
strSQL = "SELECT OrderID, CustomerID FROM Orders"
Dim da As New SqlDataAdapter(strSQL, cn)
Dim ds As New DataSet
cn.Open()
da.Fill(ds, "Orders")

Dim strDebug As String
For Each col As DataColumn In ds.Tables("Orders").Columns
strDebug = col.ColumnName.ToString + " , " +
col.DataType.ToString
Debug.WriteLine(strDebug)
Next col
cn.Close()

Thanks, again.
Randy
 
Figured it out. For any other rookies like me that might stumble onto
this post, the way to view the debug.writeline output is to display
the Output window. This can be done by clicking View - Other Windows
- Output Window or Ctrl-Alt-O.

Thanks for your help.
 
Back
Top