Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 510
  • Last Modified:

Printing Crystal Reports from VB

I am using Crystal Reports in my VB program to provide reports.  Now, these reports need to be printed also.  If I just use the default print button that comes with Crystal Reports everything is fine.  The report gets printed in the format it is supposed to be on the default printer.

Recently I was asked to change the printing functionality to allow the users to select a printer other that the default printer.  I have tried to use the Printer dialog box in VB.  The first time the user selects a printer - any printer - the report prints fine.  If the user does not close the report (form) and wants to print againg, and selects a different printer the formatting of the report goes bad (really bad).  It appears that vb does not use the correct driver.  

I need to allow my users to select a printer other that the default printer.  Any suggestions?

Thanks!
0
moncsi
Asked:
moncsi
1 Solution
 
daveherrmannCommented:
Sure, dont use the print dialog in vb to select your printer.  I'm assuming your using the ocx to print the reports and your not using the api.

Right click on the ocx, click on the preview window tab and click on printer select.  This will add the printer setup button to the preview window.  If your doing it through the report designer, there is a similiar option (my machine is messed up or I would tell you where that is)
0
 
mlmccCommented:
Can you provide the code you use to do the printing?

If you allow the users to preview the report you can add a printer selection button to the preview screen by setting

CR1.WindowShowPrintSetupBtn = True

thanks
mlm
0
 
Richie_SimonettiCommented:
Learning...
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
moncsiAuthor Commented:
Guys,

I am using RDC.  I have tried several different ways of letting the user select the printer.

Right now all I have is sending parameter in for the report, showing the report, then printing the report by using the defult print button on Crystal.  When using the VB common dialog, I do get the correct printer, but the output sucks.  If I do not use the common dialog I can not change the printer.  RDC has a method called SelectPrinter (driver, name, port) when I tried to use this I got a message saying I do not have enough memory.

I wanted to try the WindowShowPrintSetupBtn  property, but I could not find that property anywhere.

Help!
0
 
daveherrmannCommented:
try this
 CRPrinterSettings.PrinterSetup Me.hWnd

the full doc with an exampl can be found at
http://support.crystaldecisions.com/communityCS/FilesAndUpdates/printersettings.zip.asp?AJID=90FBBEF569D47A4A8EC1D52AD7C38FCD
0
 
moncsiAuthor Commented:
Thanks for the link.  It seems to have the same problem I do.  When I click on the Printer Setup Method to change the printer everything seems to be fine.  But when it prints it prints to the default printer no matter what was selected.  I think I am missing something!
0
 
daveherrmannCommented:
can you post your code?
0
 
ncwCommented:
I use crpReport.SelectPrinter (driver, name, port) and it works fine. My program allows the user to select a printer displayed in a listbox, the code iterates through the Printer collection setting the Printer object to the one matching the devicename the user selected, then I set:

crpReport.SelectPrinter Printer.DriverName, Printer.DeviceName, Printer.Port

Ok I have got 256K RAM but other machines it runs on have far less and they are ok.
0
 
Jules_MadgwickCommented:
Using
CrystalReport1.PrinterSetup Me.hWnd
works fine !!!!
0
 
DanRollinsCommented:
Hi moncsi,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept daveherrmann@idg's comment(s) as an answer.

moncsi, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: Please COMMENT.  I don't really know who deserves points here.
==========
DanRollins -- EE database cleanup volunteer
0
 
NetminderCommented:
Per recommendation, force-accepted.

Netminder
CS Moderator
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now