Microsoft KB Archive/173362

= FIX: RichTextBox SelPrint Method Does Not Print Entire Selection =

Article ID: 173362

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q173362



SYMPTOMS
When using the SelPrint method to print a selection or the contents of a RichTextbox control, the entire text may not print.



RESOLUTION
To work around this problem, you can use API function calls to print the contents of the RichTextBox control.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been fixed in Visual Basic 6.0.



Steps to Reproduce Behavior
 Open a new "Standard EXE" project. Click Components on the Project menu. Check "Microsoft Rich TextBox Control 5.0," and click OK. Add a RichTextBox control and a CommandButton to Form1.  Add the following code to Form1: Private Sub Command1_Click Printer.Print "" RichTextBox1.SelPrint Printer.hDC False Printer.EndDoc End Sub

Private Sub Form_Load 'Add 100 lines of text to the RichTextBox control With RichTextBox1 .Text = "" For i = 1 to 100 .Text = .Text & i & Chr(10) Next End With End Sub  Press the F5 key to run the application. Click Command1. Notice that all 100 lines are not printed.</li></ol>

<div class="references_section">