prints only when I close my program 
Author Message
 prints only when I close my program

I try to print the contents of a rich text box (RtbBrief) via a commondialog
(ComDial) with the following code:

ComDial.Flags = cdlPDReturnDefault + cdlPDNoPageNums
    If RtbBrief.SelLength = 0 Then
        ComDial.Flags = ComDial.Flags + cdlPDAllPages
    Else
        ComDial.Flags = ComDial.Flags + cdlPDSelection
    End If
    ComDial.ShowPrinter
    Printer.Print ""
    RtbBrief.SelPrint Printer.hDC

But it prints only ( the last contents) when I shut down my program.
How do I correct this?
Thanks in advance.



Sun, 06 Oct 2002 03:00:00 GMT  
 prints only when I close my program

Quote:

> I try to print the contents of a rich text box (RtbBrief) via a commondialog
> (ComDial) with the following code:

> ComDial.Flags = cdlPDReturnDefault + cdlPDNoPageNums
>     If RtbBrief.SelLength = 0 Then
>         ComDial.Flags = ComDial.Flags + cdlPDAllPages
>     Else
>         ComDial.Flags = ComDial.Flags + cdlPDSelection
>     End If
>     ComDial.ShowPrinter
>     Printer.Print ""
>     RtbBrief.SelPrint Printer.hDC

> But it prints only ( the last contents) when I shut down my program.
> How do I correct this?

 Try adding the line

   Printer.EndDoc

...the EndDoc method releases the document to the print device.

--
Jim in Cleveland
If you're writing to me, in my address
change "REAL_Address.see.below" to "worldnet.att.net"
 ((("What's so funny 'bout peace, love & understanding?" - Nick Lowe)))



Wed, 09 Oct 2002 03:00:00 GMT  
 prints only when I close my program
Or you could use the RTB built in print command.

Private Sub Command1_Click()
   CommonDialog1.Flags = cdlPDReturnDC + cdlPDNoPageNums
   If RichTextBox1.SelLength = 0 Then
      CommonDialog1.Flags = CommonDialog1.Flags + cdlPDAllPages
   Else
      CommonDialog1.Flags = CommonDialog1.Flags + cdlPDSelection
   End If
   CommonDialog1.ShowPrinter
   Printer.Print ""
   RichTextBox1.SelPrint CommonDialog1.hDC
End Sub

Mike


Quote:
> I try to print the contents of a rich text box (RtbBrief) via a
commondialog
> (ComDial) with the following code:

> ComDial.Flags = cdlPDReturnDefault + cdlPDNoPageNums
>     If RtbBrief.SelLength = 0 Then
>         ComDial.Flags = ComDial.Flags + cdlPDAllPages
>     Else
>         ComDial.Flags = ComDial.Flags + cdlPDSelection
>     End If
>     ComDial.ShowPrinter
>     Printer.Print ""
>     RtbBrief.SelPrint Printer.hDC

> But it prints only ( the last contents) when I shut down my program.
> How do I correct this?
> Thanks in advance.



Mon, 14 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. invalid side after printing report and closed program

2. How to close VB 4.0 16 bit program when a Crystal report Window is closed

3. Removing program title from Close Program Dialog

4. How can you close a program from another program

5. Removing program title from Close Program Dialog

6. API to Close other programs and verify if program is run

7. closing VB-program with VBA

8. Closing Access program takes forever.

9. Maximize Excess Program Window before close Word

10. Saving information, even if the program is closed

11. Close Program

12. detecting close of a shelled dos program in vb5

 

 
Powered by phpBB® Forum Software