在Windows窗体应用程序中编写跟踪信息 [英] Writing trace information in a windows form app

查看:116
本文介绍了在Windows窗体应用程序中编写跟踪信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何编写可以在Webforms环境中查看的跟踪语句,但是如何在Windows窗体应用程序中执行此操作?



我在一个静态方法,我想显示它正在生成的sql查询。



我没有访问messagebox.show,我的选择是什么? p>

解决方案

最简单的方法是使用 System.Diagnostics.Debug.WriteLine System.Diagnostics.Trace.WriteLine 。如果连接了调试器,则消息将显示在输出窗口中,否则运行 DebugView 查看消息(您需要使用过滤器来排除噪音)。


I know how to write trace statements that I can view in a webforms environment, but how do I do this in a windows forms app?

I am inside of a static method, and I want to display the sql query that it is generating.

I don't have access to messagebox.show, what are my options?

解决方案

The simplest way is to use either System.Diagnostics.Debug.WriteLine or System.Diagnostics.Trace.WriteLine. If you have a debugger attached, the messages will show up in the output window, otherwise run DebugView to see the messages (you'll need to play with the filtering some to exclude the noise).

这篇关于在Windows窗体应用程序中编写跟踪信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆