vb.net - 在 VB.NET win 窗体项目中将输出发送到标准输出(控制台)

标签 vb.net stdout

我有一个带有字符串变量的应用程序,它重复从数据库中获取日期,对该字段执行某些操作,然后转到下一行。

有没有一种方法可以将一些调试信息发送到标准输出控制台,以便我可以更好地调试/查看程序的进度?

最佳答案

您可以使用 Debug.WriteLine .

您可以配置您的应用程序以使用 ConsoleTraceListener :

To direct all trace and debug messages to the console while the application executes, add a ConsoleTraceListener object to the application configuration file. Edit the configuration file that corresponds to the name of your application, or the app.config file in a Visual Studio 2005 project. In this file, insert an element for a ConsoleTraceListener.

The following example adds a ConsoleTraceListener object named configConsoleListener to the Listeners collection.

<configuration>
  <system.diagnostics>
    <trace autoflush="false" indentsize="4">
      <listeners>
        <add name="configConsoleListener" 
          type="System.Diagnostics.ConsoleTraceListener" />
      </listeners>
    </trace>
  </system.diagnostics>
 </configuration>

然后您可以调用 Debug.WriteLine,它将记录到输出控制台。

关于vb.net - 在 VB.NET win 窗体项目中将输出发送到标准输出(控制台),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1121025/

相关文章:

vb.net - 初始化集合类

c# - 如何在我的 VB.net 应用程序中处理来自 c# Web 服务的区分大小写的类和方法

vb.net - listView.SortKey = ColumnHeader.Index - 1

vb.net - vb中获取多个文件的创建日期

asp.net - Visual Studio 2015 中的 "Visual Basic 10.0 does not support readonly auto-implemented properties"错误

compilation - 编译 'hello, world' GNU smalltalk

linux - 第一个 "if-then"语句不会在 Mint 上将标准输出重定向到/dev/null

c - 退出程序后输出执行UNIX命令

c++ - 在 C++ 程序中更改标准输出的值

c++ - 是否可以在程序运行时获取程序的输出?