Results 1 to 3 of 3

Thread: Printing Selected text in a RichTextBox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    treehouse
    Posts
    106
    I am trying to print selected text or the entire page if nothing is selected. but for some reason the "SelText" Property is retaining the text and when I set it to "" it clears out the text that was selected previously in the RichTextBox.


    here is the code:


    Code:
    Private Sub Command1_Click()
    
    If Not RTFPrint.SelText = "" Then
        Printer.Print RTFPrint.SelText
        Printer.EndDoc
    Else
        Printer.Print RTFPrint.Text
        Printer.EndDoc
    End If
    RTFPrint.SelText = ""
    End Sub

  2. #2
    Guest
    Try this:

    Code:
    Private Sub Command1_Click()
    If RTFPrint.SelText <> "" Then
    RTFPrint.SelPrint (Printer.hDC)
    End If
    End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Location
    treehouse
    Posts
    106
    Thanks Matthew, That worked.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width