phillip.hess@dot.gov
Member
- Joined
- Nov 9, 2009
- Messages
- 16
- Programming Experience
- Beginner
Greetings
I'm relatively new to Visual Basic I’ve been looking for a solution to this for two days. I have a report that I need to print out in landscape. That part isn’t a problem. I need to read the text in the line that’s read by the reader and see if the substring is “Page#”. I can do that but when the reader reads the next line it appends it to the first line. The means that the substring will always say “Page#”. I need to read the text “Page#” place 45 more lines of text and then force a new page. Then start the hole thing over again with the next page.
Here is my code:
Using objReader As New IO.StreamReader("C:\Temp\GeoRptTemp.txt", False)
Do While objReader.Peek() <> -1
i = i + 1
TextLine = TextLine & objReader.ReadLine() & vbNewLine
If TextLine.Length > 106 Then
strPage = TextLine.Substring(100, 6)
If strPage = "Page#" Then
strPage = ""
ElseIf i = 45 Then
TextLine = vbCrLf
End If
End If
RichTextBoxPrintCtrl1.Font = New Font("Lucida Console", 10, FontStyle.Regular)
RichTextBoxPrintCtrl1.Text = TextLine
Loop
End Using
Attached is a sample of the report.
Any help would be appreciated
I'm relatively new to Visual Basic I’ve been looking for a solution to this for two days. I have a report that I need to print out in landscape. That part isn’t a problem. I need to read the text in the line that’s read by the reader and see if the substring is “Page#”. I can do that but when the reader reads the next line it appends it to the first line. The means that the substring will always say “Page#”. I need to read the text “Page#” place 45 more lines of text and then force a new page. Then start the hole thing over again with the next page.
Here is my code:
Using objReader As New IO.StreamReader("C:\Temp\GeoRptTemp.txt", False)
Do While objReader.Peek() <> -1
i = i + 1
TextLine = TextLine & objReader.ReadLine() & vbNewLine
If TextLine.Length > 106 Then
strPage = TextLine.Substring(100, 6)
If strPage = "Page#" Then
strPage = ""
ElseIf i = 45 Then
TextLine = vbCrLf
End If
End If
RichTextBoxPrintCtrl1.Font = New Font("Lucida Console", 10, FontStyle.Regular)
RichTextBoxPrintCtrl1.Text = TextLine
Loop
End Using
Attached is a sample of the report.
Any help would be appreciated