Form Feeds in Printed Reports

Joined
Jun 17, 2003
Messages
7
I am struggling a bit with printing reports in .NET. VB6 was easy in comparison. I have a database search application that should print out the results of a search typed in by the user. The results are in the form of a text file I generated. Here is the code I use to create the text file. The printheader routine is called to create the header for the page and the printdetail is call repeatedly, once for each match that is made in the database:

Public Sub printheader()
xr_temp = "CROSS REFERENCE FACILITY "
xr_temp = xr_temp & "Printed " & DateString & " at " & TimeString

PrintLine(3, xr_temp)
xr_temp = "-----------------------------------------------------------"
xr_temp = xr_temp & "------------------------------"
PrintLine(3, xr_temp)
PrintLine(3, " ")

End Sub

Public Sub printdetail(ByVal xr_printstring As String, ByVal xr_compstring As String)
xr_temp = "Search Field : " & xr_compstring
PrintLine(3, xr_temp)

xr_temp = "AGCS Part Number : " & Mid(xr_printstring, 18, 12)
PrintLine(3, xr_temp)

xr_temp = "Vendor : " & Mid(xr_printstring, 33, 15)
PrintLine(3, xr_temp)

xr_temp = "Vendor Part Number : " & Mid(xr_printstring, 63, 30)
PrintLine(3, xr_temp)

xr_temp = "Description : " & Mid(xr_printstring, 147, 39)
PrintLine(3, xr_temp)

xr_temp = "Blacklist Code : " & Mid(xr_printstring, 109, 6)
PrintLine(3, xr_temp)

xr_temp = "Comments : " & Mid(xr_printstring, 191, 58)
PrintLine(3, xr_temp)

xr_temp = "Package : " & Mid(xr_printstring, 97, 12)
PrintLine(3, xr_temp)

xr_temp = "Mask : " & Mid(xr_printstring, 121, 10)
PrintLine(3, xr_temp)

xr_temp = "Engineer : " & Mid(xr_printstring, 249, 3)
PrintLine(3, xr_temp)

xr_temp = "Part Marking : " & Mid(xr_printstring, 257, 30)
PrintLine(3, xr_temp)

xr_temp = "Packaging Method : " & Mid(xr_printstring, 287, 13)
PrintLine(3, xr_temp)

xr_temp = "Moisture Sensitivity : " & Mid(xr_printstring, 300, 13)
PrintLine(3, xr_temp)

xr_temp = "Tray Number : " & Mid(xr_printstring, 313, 30)
PrintLine(3, xr_temp)
PrintLine(3, " ")
PrintLine(3, vbFormFeed)

End Sub


After I have created and closed the text file, I call the
 
Back
Top