Link to home
Start Free TrialLog in
Avatar of BirdsOfFire1
BirdsOfFire1

asked on

Document Prints after Pressing the Cancel Button in the Print Dialog Box

Welcome any ideas.

I am using VB6.0 with crystal reports.  After displaying a crystal report and then opening the print dialog box and the user decides not to print the document, finally the user presses the cancel button to cancel the print dialog box, the document (the Crystal Report) still prints.  Is there anyway to get around this?  

If not, request code and explanation of the code to create a print dialog box in VB.  

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mcoop
mcoop


Examine the CancelError property in the COmmon Dialog control.   This property allows you to trap the CANCEL button - as an error -  if the user backs out of the dialog.

A common misconception is that 'Cancel' is processed automatically by the control - this is incorrect!  You must explicitly set the CancelError property to TRUE, and have an error handler in place to catch the event.
Avatar of BirdsOfFire1

ASKER

To:  mlmcc

I appreciate any help you can give me on developing my own printer control and then return the button selection to the VB call and test if CANCEL was pressed.

Thanks.  I'll be waiting.


 
I have a sample program that includes my Printer_Control form available.  Unfortunately I cannot post it on my web page from work.  I will put it there tonight and provide a link to it in my next response.

If you would like the sample before then send me your e-mail and I will e-mail it to you.

good luck
mlmcc
To:  mlmcc

This may reach you after work, if not, my e-mail address is:  BirdsOfFire@Juno.com.


BirdsOfFire1