Expand Your VB6 Printing RepertoirePart II

Build this simple text editor and see how easy it can be to add Print and Print Preview capabilities to your applications without resorting to third-party controls.

by Evangelos Petroutsos

Feb 10, 2004

Page 1 of 4

n last month's 10 Minute Solution you explored the basics of printing with VB6. This month's solution continues that exploration by presenting basic code for printing and previewing text. In the process you'll build the PrintText project, which is a very simple text editor with print and preview capabilities.

Although VB6's Printer object is convenient, printing in VB has some serious limitations, such as a lack of support for controls for printing and previewing documents (a situation that was rectified in VB.NET). Generating elaborate printouts with VB6 requires a substantial programming effort; therefore most VB6 developers use third party controls for their printouts. But you don't always want to include a large printing library to gain decent print capabilities; therefore, good printing tools have their place in every developer's utilities collection.

You don't have to rely on third-party controls to gain additional printer control in VB. This solution reviews the basics of printing with VB6 and then applies the basic concepts to build some practical tools and utilities.