Application #41. Simple Printing

This sample application demonstrates how to print from a Visual Basic .NET program. The main class that all .NET printing revolves around is known as the PrintDocument class. In addition to providing the PrintDocument class, Visual Basic .NET also provides PrintPreviewDialog, PrintDialog, and PageSetupDialog classes. With these classes, you can add professional-quality printing support to your applications.

The sample application, shown in Figure 4-19, consists of a main form with a text box and three command buttons. When the form loads, the text box is populated with Abraham Lincoln’s famous Gettysburg Address as sample data. The first button, Print Preview, will use the PrintPreviewDialog class to display ...

Get 101 Microsoft® Visual Basic® .NET Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.