Results 1 to 2 of 2

Thread: Printing text

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    NY
    Posts
    12

    Printing text

    hi all , I need to print some very long formatted text(like word document but not word file ) thru vb. it may containt pictures also . it contains some dynamic data that is coming from DB ( I have written procedure to get the text wat I want )
    so basically wat I need is on click over a command button it should print that long package. I tried ... with ..
    richtextBox but it does not have built in option to print the text .
    I tried to work with Word liberary but dont know how to use it.

    Please help .
    regards
    -Mala

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    This will print the contents of a RichTextBox:
    VB Code:
    1. Private Sub PrintRTB(rtb As RichTextBox)
    2.     If Len(rtb.Text) = 0 Then Exit Sub
    3.     rtb.SelStart = 0
    4.     rtb.SelLength = Len(rtb.TextRTF)
    5.     rtb.SelPrint Printer.hDC
    6. End Sub

    You can just use the SelPrint method, or use that code and just pass in the RichTextBox control you want to print.

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