Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting a printer other than default 1

Status
Not open for further replies.

awhitsel

Programmer
Feb 22, 2001
80
US
Is there any way that I can show the standard Windows dialog box for selecting a printer for a CR9 report in a VB5 application?

Please advise.

Thanks.
 
Use the PrinterSetup method of the Report object.

This is how I do this with VB6 and Crystal 8.5 using the RDC and the CRViewer control (I don't think the object model changed that drastically for the rdc or the viewer between 8.5 and 9.0).
Code:
Private Sub CRViewer_PrintButtonClicked(UseDefault As Boolean)

    UseDefault = False

    'Invoke the Printer Setup dialog
    crxRpt.PrinterSetup Me.hWnd

    Dim p As Printer
    For Each p In Printers
        If p.DeviceName = crxRpt.PrinterName Then
            crxRpt.SelectPrinter p.DriverName, p.DeviceName, p.Port
            Exit For
        End If
    Next p

    crxRpt.PrintOut True, 1

End Sub
-dave
 
Will this method work if I am not using the CRViewer control to look at the document before I print it.

I just want to be able to print it out with no whistles and bells -- just click the print button, select and accept the printer selection, and the report gets printed out.

Please advise.

Thanks.
 
Yeah, it'll work without the viewer, just put the above code into your cmdPrint_Click event (get rid of UseDefault = False), and set the arguments of the PrintOut method however you want.

PrintOut ([promptUser], [numberOfCopy], [collated], [startPageN], [stopPageN])

-dave
 
hmm.. can i ask wat is the RDC u referred to?? i'm using CR 8.5 and VB v6. is there any references that i'll need to add? thanks!
 
Thanks! I've managed to do it.Wow, ur rersponse is sure fast!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top