How to: Fix Upgrade Errors by Using the Printer Compatibility Library
The Printer Compatibility library emulates the functionality of the Visual Basic 6.0 Printer object, which enables the Printer code in applications that have been upgraded from Visual Basic 6.0.
To fix Printer upgrade errors
Open the application in Visual Studio.
If a Visual Basic 6.0 application has not yet been upgraded, opening it in Visual Studio will start the Upgrade tool.
On the Project menu, click Add Reference.
In the Add Reference dialog box, on the .NET tab, click Microsoft.VisualBasic.PowerPacks.Printing.Printer, and then click OK.
In the Code Editor, add the following statement at the top of the module that contains your Visual Basic 6.0 Printer code:
Add the following code at the top of the procedure that contains Printer code:
Public Printer As New Printer
Most errors related to the Printer object will disappear from the Error List, and your Printer code should compile and run just as it did in Visual Basic 6.0.
You must manually remove all error or warning comments that appear in the code, but these comments will not prevent the code from compiling. Some warnings may remain in the Task List; frequently these are related to Visual Basic 6.0 Variant types that were upgraded to Object and that can safely be ignored.
In some cases, code that uses the Circle, Line, or PSet methods will have to be modified before the code compiles. The Visual Basic 6.0 versions of these methods contained parentheses around X/Y pairs in the method signatures. These parentheses must be moved in order for the code to compile in Visual Basic 2005.
For example, the upgraded Visual Basic 6.0 code Printer.Circle (1000, 1000), 2000 would have to be changed to Printer.Circle (1000, 1000, 2000) in order to compile.