BUG: Printer Error When Printing from RTF ControlLast reviewed: February 12, 1996Article ID: Q142290 |
The information in this article applies to:
SYMPTOMSAfter printing from a Rich Text Box control, Visual Basic 4.0 raises error 482 - "Printer Error". This error can occur when exiting a Visual Basic application or when executing the EndDoc method of the Printer object.
WORKAROUNDAfter printing from a RTF control, executing an EndDoc will exhibit this problem. Visual Basic executes an automatic Printer.EndDoc if a program stops execution with buffered data. Even though this error is raised, the pages do print correctly. The workaround for this problem is to trap error 482 and simply ignore it. The example below contains code to demonstrate this technique.
STATUSMicrosoft has confirmed this to be an issue in the Microsoft products listed at the beginning of this article. We are researching this problem and will post more information here in the Microsoft Knowledge Base when it becomes available.
MORE INFORMATION
Steps to Reproduce
Private Sub Command1_Click() Printer.Print "" RichTextBox1.SelPrint Printer.hDC On Error GoTo EndDocError Printer.EndDoc On Error GoTo 0 Exit Sub EndDocError: If Err.Number = 482 Then 'do nothing Else Err.Raise Err.Number End If End SubThis code initializes the printer object and prints from the RTF control. Error trapping is turned on, and if the error that occurs with the EndDoc method is number 482, it is ignored. If some other error is raised as a result of the EndDoc method, that error is passed upwards in the call stack to be handled by another procedure or Visual Basic as normal.
Additional NoteThe RTF sample application included with the Visual Basic 4.0 MSDN Starter Kit was written using a different version of the RTF control than the one that shipped with Visual Basic 4.0. As a result, the above fix is not implemented in the code for that sample application. The RTF sample can be fixed by the same method outlined above; simply trap error 482 and ignore it.
|
Additional reference words: 4.00 vb4win vb432
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |