A typical text based report is generated in several pieces.
First, you need to choose a printer, tell the LinePrinter class how to control that printer, and create a connection to the printer. You also need to connect event handlers for status and warning events and for headers and footers.
Then the actual report body must be generated and sent to the printer. This often involves the use of different font styles.
After the application sends the report to the printer, the application must clean up any resources used. This is made easier with .NET as memory cleanup is generally not a consideration. Just what needs to be cleaned up varies from printer to printer, but the LinePrinter class handles this detail so that the application programmer does not need to worry about it. The programmer must simply ensure that the application calls the Close method.
Finally, a system must be in place to handle problems if something goes wrong during the report. In some cases this will involve fixing the problem and continuing with the report, or it may mean killing the report and telling the user what went wrong.
Step 1: Set up to print.
Step 2: Generate the report.
Step 3: Clean up resources.
Step 4: Set up error handling.
Next » Print Routine: Set Up to Print
Back « LinePrinter Tutorial