.txt formatting with vbCrLf

mtaylor314

Member
Joined
Nov 30, 2006
Messages
19
Location
Cleves, OH
Programming Experience
Beginner
I need a little bit of help with the following code. I am trying to print in a particular format, which I thought this did, but it seems to add an extra vbCrLf to the .txt file, to make it appear to be double spaced. I took out some of the vbCrLf's and all that did was not move to the next line. It is either no newline or 2 newlines. Does anybody have any suggestions?

VB.NET:
Public Sub PrintFormatText(ByVal toPrint As String, _
                               ByVal sw As StreamWriter, _
                               ByVal len As Integer)
  

        Dim lines() As String = toPrint.Split(Environment.NewLine.ToCharArray)
        For Each line As String In lines
            If line.Length > len Then

                sw.WriteLine(line.Substring(0, len))

                End If
            Else
                sw.WriteLine(line)
            End If
        Next line
End Sub
 
Back
Top