Accessing the output from Console.Writeline

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Randy

    #1

    Accessing the output from Console.Writeline

    What does Console.Writeli ne 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

  • Charlie Brown

    #2
    Re: Accessing the output from Console.Writeli ne

    On Apr 26, 5:04 pm, Randy <spam.eastl...@ gmail.comwrote:
    What does Console.Writeli ne 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.Writeli ne 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.

    Comment

    • Randy

      #3
      Re: Accessing the output from Console.Writeli ne

      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("Orde rs").Columns
      strDebug = col.ColumnName. ToString + " , " +
      col.DataType.To String
      Debug.WriteLine (strDebug)
      Next col
      cn.Close()

      Thanks, again.
      Randy

      Comment

      • Randy

        #4
        Re: Accessing the output from Console.Writeli ne

        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.

        Comment

        • Herfried K. Wagner [MVP]

          #5
          Re: Accessing the output from Console.Writeli ne

          "Randy" <spam.eastland@ gmail.comschrie b:
          What does Console.Writeli ne 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.

          --
          M S Herfried K. Wagner
          M V P <URL:http://dotnet.mvps.org/>
          V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

          Comment

          Working...