469,625 Members | 1,708 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,625 developers. It's quick & easy.

writing own debug messages to debug window

Sorry for all who think this is easy, I was not able to handle this

Coming from VB6 where with simple

debug.print strAString

you could write to debug window, I am totalling failing in vb.net 2003
The sample in the help file does not work. I tried now for days ...

Pls could anybody post a sample, including necessary imports and so on -
thank you so much in advance
Nov 20 '05 #1
7 18547
Hi Thomas

Debug.WriteLine(strAString)

The string will appear in the Output window, as opposed to the command
window as it does in VB6.

HTH

Charles
"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
Sorry for all who think this is easy, I was not able to handle this

Coming from VB6 where with simple

debug.print strAString

you could write to debug window, I am totalling failing in vb.net 2003
The sample in the help file does not work. I tried now for days ...

Pls could anybody post a sample, including necessary imports and so on -
thank you so much in advance

Nov 20 '05 #2
TNX, but did not work
does this also work if I do a PPC App

The help says :

Public Shared Function Main(args() As String) As Integer
Debug.Listeners.Add(New TextWriterTraceListener(Console.Out))
Debug.AutoFlush = True
Debug.Indent()
Debug.WriteLine("Entering Main")
Console.WriteLine("Hello World.")
Debug.WriteLine("Exiting Main")
Debug.Unindent()
Return 0
End Function 'Main

but then I get a build error because TextWriterTraceListener is not known (I
imported diagnostics)

big ???? here - sorry

"Charles Law" <bl**@thingummy.com> schrieb im Newsbeitrag
news:uI**************@TK2MSFTNGP10.phx.gbl...
Hi Thomas

Debug.WriteLine(strAString)

The string will appear in the Output window, as opposed to the command
window as it does in VB6.

HTH

Charles
"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
Sorry for all who think this is easy, I was not able to handle this

Coming from VB6 where with simple

debug.print strAString

you could write to debug window, I am totalling failing in vb.net 2003
The sample in the help file does not work. I tried now for days ...

Pls could anybody post a sample, including necessary imports and so on -
thank you so much in advance


Nov 20 '05 #3
Thomas,
As Charles stated, Print is now Write & WriteLine in VB.NET

Debug.Write(strAString)
Debug.WriteLine(strAString)

In addition to the Debug class, there is also a Trace Class. Normally calls
to the Debug class are removed during release builds, while calls to the
Trace class are available in both Debug & Release builds.

In addition to Write & WriteLine both classes have: WriteIf, WriteLineIf,
Indent, Unindent, Assert, and Fail methods. Which allow for a richer
formatting of the output.

Oh! Write, WriteLine, WriteIf, and WriteLineIf support giving a category,
which is useful to label your output.

Debug.WriteLine(strAString, "strAString")
Debug.WriteLine(index, "index")

Trace.WriteLine(strAString, "strAString")
Trace.WriteLine(index, "index")

Hope this helps
Jay

"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
Sorry for all who think this is easy, I was not able to handle this

Coming from VB6 where with simple

debug.print strAString

you could write to debug window, I am totalling failing in vb.net 2003
The sample in the help file does not work. I tried now for days ...

Pls could anybody post a sample, including necessary imports and so on -
thank you so much in advance

Nov 20 '05 #4
I'm sorry, I don't know what you mean by a PPC App. Do you mean a console
application? If so, I have just created a new console app and added a single
line to main:

Module Module1
Sub Main()
Debug.WriteLine("Hello world")
End Sub
End Module

It compiles and runs, and outputs Hello world to the Output window. Is that
what you are after?

Charles
"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
TNX, but did not work
does this also work if I do a PPC App

The help says :

Public Shared Function Main(args() As String) As Integer
Debug.Listeners.Add(New TextWriterTraceListener(Console.Out))
Debug.AutoFlush = True
Debug.Indent()
Debug.WriteLine("Entering Main")
Console.WriteLine("Hello World.")
Debug.WriteLine("Exiting Main")
Debug.Unindent()
Return 0
End Function 'Main

but then I get a build error because TextWriterTraceListener is not known (I imported diagnostics)

big ???? here - sorry

"Charles Law" <bl**@thingummy.com> schrieb im Newsbeitrag
news:uI**************@TK2MSFTNGP10.phx.gbl...
Hi Thomas

Debug.WriteLine(strAString)

The string will appear in the Output window, as opposed to the command
window as it does in VB6.

HTH

Charles
"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
Sorry for all who think this is easy, I was not able to handle this

Coming from VB6 where with simple

debug.print strAString

you could write to debug window, I am totalling failing in vb.net 2003
The sample in the help file does not work. I tried now for days ...

Pls could anybody post a sample, including necessary imports and so on - thank you so much in advance



Nov 20 '05 #5
Thomas,
What kind of app are you building? A .NET Compact Framework app?

TextWriterTraceListener is not supported on the .NET Compact Framework.

When looking at help, check the "Requirements - Platforms" section at the
bottom of the page.

Remove that line along with the Indent & Unindent and your app 'should'
work. Again check the help for what classes & members are supported on which
platform.

Hope this helps
Jay

"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
TNX, but did not work
does this also work if I do a PPC App

The help says :

Public Shared Function Main(args() As String) As Integer
Debug.Listeners.Add(New TextWriterTraceListener(Console.Out))
Debug.AutoFlush = True
Debug.Indent()
Debug.WriteLine("Entering Main")
Console.WriteLine("Hello World.")
Debug.WriteLine("Exiting Main")
Debug.Unindent()
Return 0
End Function 'Main

but then I get a build error because TextWriterTraceListener is not known (I imported diagnostics)

big ???? here - sorry

"Charles Law" <bl**@thingummy.com> schrieb im Newsbeitrag
news:uI**************@TK2MSFTNGP10.phx.gbl...
Hi Thomas

Debug.WriteLine(strAString)

The string will appear in the Output window, as opposed to the command
window as it does in VB6.

HTH

Charles
"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
Sorry for all who think this is easy, I was not able to handle this

Coming from VB6 where with simple

debug.print strAString

you could write to debug window, I am totalling failing in vb.net 2003
The sample in the help file does not work. I tried now for days ...

Pls could anybody post a sample, including necessary imports and so on - thank you so much in advance



Nov 20 '05 #6
"Thomas Pecha" <th**********@firstinex.at> schrieb:
Coming from VB6 where with simple

debug.print strAString

you could write to debug window, I am totalling failing in vb.net 2003
The sample in the help file does not work. I tried now for days ...


Use 'System.Diagnostics.Debug.WriteLine' instead.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #7
Nope.
"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
TNX, but did not work
does this also work if I do a PPC App

The help says :

Public Shared Function Main(args() As String) As Integer
Debug.Listeners.Add(New TextWriterTraceListener(Console.Out))
Debug.AutoFlush = True
Debug.Indent()
Debug.WriteLine("Entering Main")
Console.WriteLine("Hello World.")
Debug.WriteLine("Exiting Main")
Debug.Unindent()
Return 0
End Function 'Main

but then I get a build error because TextWriterTraceListener is not known (I imported diagnostics)

big ???? here - sorry

"Charles Law" <bl**@thingummy.com> schrieb im Newsbeitrag
news:uI**************@TK2MSFTNGP10.phx.gbl...
Hi Thomas

Debug.WriteLine(strAString)

The string will appear in the Output window, as opposed to the command
window as it does in VB6.

HTH

Charles
"Thomas Pecha" <th**********@firstinex.at> wrote in message
news:O4**************@TK2MSFTNGP10.phx.gbl...
Sorry for all who think this is easy, I was not able to handle this

Coming from VB6 where with simple

debug.print strAString

you could write to debug window, I am totalling failing in vb.net 2003
The sample in the help file does not work. I tried now for days ...

Pls could anybody post a sample, including necessary imports and so on - thank you so much in advance



Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by news frontiernet.net | last post: by
2 posts views Thread by Dennis M. Marks | last post: by
2 posts views Thread by Kevin | last post: by
10 posts views Thread by Brett | last post: by
46 posts views Thread by Ian Boyd | last post: by
2 posts views Thread by Bob S | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.