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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.