What replaces debug.print?

  • Thread starter Thread starter Elmo Watson
  • Start date Start date
E

Elmo Watson

I need to know, in several places in my code, what a variable is. In Vs6, I
would just enter a debug.print line for that variable, and it would appear
in the Immediate window.

I've tried debug.write and searched for something that will do the same
thing in VS.Net 2005, but as of yet, have not found something that does the
same job...

How can this be done in VS.net 2005?
 
I need to know, in several places in my code, what a variable is. In Vs6, I
would just enter a debug.print line for that variable, and it would appear
in the Immediate window.

I've tried debug.write and searched for something that will do the same
thing in VS.Net 2005, but as of yet, have not found something that does the
same job...

How can this be done in VS.net 2005?

Import System.Diagnostics

Then in your code use this call

Trace.WriteLine(yourexpressionhere)
 
I too am a refugee from VB6.

You have a lot of new alternatives in vs2005. One I didnt know woz the post
above.

Not one new thing to learn each day but many new things to learn each day.

Debug.Print still works fine for me. See it in the Menu/View/Other
Windows/Output. It iz called the 'Immediate screen' as in VB6 and Cntrl/G
displays it.

Don't give up. There are a lot more debug devices available. Yesterday, I
discovered that, if you break where a datatable has content, the content of
the datatable is available for you to view quite easily. Place the cursor on
the datatable variable and click the '+' sign that is displayed. We didnt
have anything like that in VB6 did we???

Great debug facilities

Garry

In vs2005, you have more windows to display your debug/trace output. The
console, the
 
Check the Output window (Ctrl+Alt+O or View/Output).
By default, that's where VS outputs any debug.writeline
statements. (Annoying, isn't it?)

You can change it in the settings --
Tools/Options/Debugging/General/"Redirect all Output
Window text to the Immediate Window".

You can also stop in your code, and check the Locals window.
I believe it shows all the current variables and their values.

Hope that helps.
Robin S.
 
Back
Top