Solved

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

Posted on 2001-06-09
5
652 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 50 total points
ID: 6172780
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
ID: 6172788

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
ID: 6172818
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
ID: 6177843
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
ID: 6179326
To:  mlmcc

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


BirdsOfFire1
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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