Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

simple question about .net debugging

Posted on 2005-04-08
10
Medium Priority
?
287 Views
Last Modified: 2010-04-07
in VB6 I used debug.print quite a bit. What is the equivalent to this in .net?

thanks.
0
Comment
Question by:jkwasson
  • 5
  • 3
  • 2
10 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 13740166
Debug.Write

Trace.Write
0
 
LVL 33

Assisted Solution

by:raterus
raterus earned 1000 total points
ID: 13740184
One option:

Page.Trace.IsEnabled = True 'alternatively you can set trace="true" in the <%@ Page %> directive at the top of your .aspx page
Page.Trace.Write("Something")

check the bottom of your aspx page after doing this.



0
 
LVL 35

Expert Comment

by:YZlat
ID: 13740200
The difference is that Debug.Write will only show up in a Debug mode, and not in the Release mode, and Trace.Write will show up in both. So if you use Trace.write, you will have to remove those statements before you'll switch to Release mode
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Author Comment

by:jkwasson
ID: 13740294
ok, that is good info. I didn't know about the trace stuff, so that is good info.

I still have a problem with debug.write though...

I tried this code
page.trace.isenabled = true
page.trace.write("hello world")
debug.write("hello john")
trace.write("hello john")

on debug.write, the debug is underlined and the system tells me that "'debug' is not declared"

trace.write still does not write values to the immediate window.

What I am really interested in here is replicating the functionality in vb6 where I could do debug.write "the value of x is: " & x     and I would see "the value of x is 1" in the immediate window.  what does .net use in code to write a something out to the immediate window?

Thanks!
jk
0
 
LVL 33

Accepted Solution

by:
raterus earned 1000 total points
ID: 13740374
System.Diagnostics.Debug.Write("hello bob")
0
 
LVL 5

Author Comment

by:jkwasson
ID: 13740436
ok, that worked. Shouldn't I be able to put imports system.diagnostics.debug at the top of the page and then only use debug.write("hello bob") in my code?  For some reason it will not work unless I do the full system.diagnostics.debug.write("hello bob")

thanks,
jk
0
 
LVL 33

Expert Comment

by:raterus
ID: 13740458
Just put this at the top:

Imports System.Diagnostics

You're adding .Debug in the imports statement, and on top of that using Debug.Write(), to the compiler it looks like this
System.Diagnostics.Debug.Debug.Write("Whoops!")

0
 
LVL 5

Author Comment

by:jkwasson
ID: 13740783
ah, ok that makes sense. Thanks for your help!
0
 
LVL 5

Author Comment

by:jkwasson
ID: 13740787
increasing points for split
0
 
LVL 5

Author Comment

by:jkwasson
ID: 13740809
lol, I just realized both of those answers were from the same person...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

580 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