Solved

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

Posted on 2001-06-09
5
635 Views
Last Modified: 2012-08-14
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
0
Comment
Question by:BirdsOfFire1
  • 2
  • 2
5 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 50 total points
Comment Utility
There is a way to get around it.  Unfortunately you cannot use the default printer select form which doesn't communicate with VB.

You must develop your own printer control form and then return the button selection to the VB call and test if CANCEL was pressed.

I have a form for doing that at work and can put the code in on Monday.

good luck
mlm
0
 
LVL 4

Expert Comment

by:mcoop
Comment Utility

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.
0
 

Author Comment

by:BirdsOfFire1
Comment Utility
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.


 
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
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
0
 

Author Comment

by:BirdsOfFire1
Comment Utility
To:  mlmcc

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


BirdsOfFire1
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now