WriteLine does not always add NewLine

  • Thread starter Thread starter Howard Kaikow
  • Start date Start date
H

Howard Kaikow

I have never seen WriteLine fail to produce a NewLine, at least, not until
now:

I was playing with an example given on pages 51-52 of the book "A Visual
Basic 6 Programmer's Toolkit".
The book is accompanied by files for that chapter in which an example uses
VB 6's Print to output to a Form..
When upgrading the code to VB .NET 2002, the upgrade wizard did not like
Print, so I replaced Print with Debug.Print in the VB 6 code.
and constructed the test below.

NewLine does get added for the first two WriteLine statements, but not for
those using the strBCD variable. Typically, the strBCD variable will consist
of non-printable characters, so I expect this is somehow messing up
WriteLine.

In addition, the & " / " & strCVL & " / " is output ONLY for the final
WriteLine.

Is this a known problem?
Is WriteLine supposed to treat non-printable characters in this way?
Or am I somehow screwing up?

The MKL function makes a BCD Encoded string out of a type Integer (Long in
VB 6).
The CVL function makes an Integer (Long in VB 6) out of the BCD encoded
string produced by MKL.

Spell and SpellDollar are relevant to this thread as each produces a
printable string, which WriteLine handles correctly, i.e., adds the NewLine
format effector.

---------------------------

Option Strict Off
Option Explicit On
Module modHKTests
Public Sub Main()
Dim lngInput As Integer
Dim strBCD As String
Dim strCVL As String
Dim strTemp As String
System.Diagnostics.Debug.WriteLine(mNumbers.Spell(169.51))
System.Diagnostics.Debug.WriteLine(mNumbers.SpellDollar(169.51))
For lngInput = 15 To 20
strBCD = MKL(lngInput)
strCVL = Str(CVL(strBCD))
strTemp = lngInput & ": " & strBCD & " / " & strCVL & " / "
System.Diagnostics.Debug.WriteLine(strTemp)
Next lngInput
lngInput = 16777216
strBCD = MKL(lngInput)
strCVL = Str(CVL(strBCD))
strTemp = lngInput & ": " & strBCD & " / " & strCVL & " / "
System.Diagnostics.Debug.WriteLine(strTemp)
lngInput = 2147483647
strBCD = MKL(lngInput)
strCVL = Str(CVL(strBCD))
strTemp = lngInput & ": " & strBCD & " / " & strCVL & " / "
System.Diagnostics.Debug.WriteLine(strTemp)
End Sub
End Module
 
I posted again because the original posting is not showing up here.
I even unsubscribed to the newsgroup, then resubscribed.
I still do not see the original thread.

I've seen this problem of disappearing threads/posts only on the msft news
server.
 
Howard Kaikow said:
I posted again because the original posting is not showing up
here. I even unsubscribed to the newsgroup, then resubscribed.
I still do not see the original thread.

I've seen this problem of disappearing threads/posts only on the msft
news server.

When I saw your question the second time I also thought: Haven't I already
read it a very short time ago? :) Yes, I did, but I couldn't find it
anymore. Strange....
 
I Just recalled that I've also seen the problem with posts in non-MSFT
newsgroups on another server, so it must be an Outlook Express problem.
 
Back
Top