Solved

Writing to the Immediate window

Posted on 2002-07-19
8
308 Views
Last Modified: 2012-06-27
Sheesh, this new Debug class and its Listeners confusion...how the heck do I just write output to my good old Immediate window...or the just-as-handy equivalent of an Immediate window?
0
Comment
Question by:bryker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 4

Accepted Solution

by:
DarthPedro earned 50 total points
ID: 7165470
If you just use the Trace object, it will write to the Debug window (or what used to be the Immediate window in VB6).  Something like this should work:

System.Diagnostics.Trace.WriteLine("Testing Trace output");

This is assuming that you are writing a WinForms app.  For ASP.NET, you Page object has a Trace method, so use that instead.  The ASP.NET trace doesn't go to the Debug Window, but goes onto the page itself (tacked on to the end).

To enable viewing of debug comments and such on an ASP.NET page, you need to add Trace="true" to the top-level page directive, like this:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="EETestApps.WebForm1" trace="true"%>
0
 

Author Comment

by:bryker
ID: 7165612
Great.  Thanks.

One more thing--I've found lately (in hunting for the elusive Cache object) that since I'm just doing Web Methods on a Web Service, I don't have a lot of things available to me.  One would be this Page object.

Do you know how you'd write to the Immediate window from a Web Method?

You've answered my question already, so I'm not trying to change the rules on you.  Just wondering.
0
 
LVL 4

Expert Comment

by:DarthPedro
ID: 7165639
Using the following code for a Web Service method, I was able to output the trace string to the Debug window (just like it worked for a WinForms app):

[WebMethod]
public string HelloWorld()
{
     System.Diagnostics.Trace.WriteLine("Testing the WebMethod trace...");
     return "Hello World";
}
0
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 

Author Comment

by:bryker
ID: 7165646
Awesome.  Thank you.
0
 

Author Comment

by:bryker
ID: 7165886
Dude, this doesn't work.  Not for WinForms, not for WebMethods.  I don't know where these strings are going, but it's not to my Command Window.
0
 
LVL 4

Expert Comment

by:DarthPedro
ID: 7165907
It's not the command window it's the debug output window.  You can activate it from the main menu under View > Other Windows > Output.
0
 

Author Comment

by:bryker
ID: 7165914
My bad.  You're right, there it is.  I could use a course in just how to dock all these windows so that I can see them and make sense of them.
0
 
LVL 4

Expert Comment

by:DarthPedro
ID: 7165917
:)
yeah, there's more windows than space on my monitor...
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question