473,386 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Giving user ability to cancel a print job.

I am using a PrintPreviewDialog to show a document. Via the BeginPrint
event, I open a PrintDialog to let the user choose what pages (and other
settings) to print. However, I can't find a way to allow the user to cancel
the print command if the 'Cancel' button is pressed from the PrintDialog.

I tried throwing an exception, but it is only caught when I run in debug
mode (bug in C#?). i.e. If I 'Start without debugging', then the exception I
throw is not caught. But if I 'Start with debugging', even without stepping
through the code, the exception is caught.

Anyway, any suggestions on cancelling a print job once the
PrintDocument.Print command is started?

Thanks,
--Michael
Dec 28 '05 #1
1 3556
Well folks... It seems that all I had to do was read a little deeper.

For those of you who are interested, I found that the BeginPrint event
method has a parameter 'PrintEventArgs e'. Set e.Cancel to true and the
print job is cancelled.

However, if anyone has any input on the dillemma with the exception that is
only caught while Started with the debugger, I would love to hear it.

Thanks,
--Michael

"Michael R" wrote:
I am using a PrintPreviewDialog to show a document. Via the BeginPrint
event, I open a PrintDialog to let the user choose what pages (and other
settings) to print. However, I can't find a way to allow the user to cancel
the print command if the 'Cancel' button is pressed from the PrintDialog.

I tried throwing an exception, but it is only caught when I run in debug
mode (bug in C#?). i.e. If I 'Start without debugging', then the exception I
throw is not caught. But if I 'Start with debugging', even without stepping
through the code, the exception is caught.

Anyway, any suggestions on cancelling a print job once the
PrintDocument.Print command is started?

Thanks,
--Michael

Dec 28 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: eddie wang | last post by:
Excel open automatically without giving a dialog box option to Open/Save/Cancel using filesys.createTextFile. How to pop up the dialog box option to Open/Save/Cancel? Thanks.
3
by: xscully | last post by:
Is there a way to force the user to read a textarea? Just like those 'agreements' that is used in a few offline instalation.. You have to scroll all the way down of the textarea and then the I...
4
by: louise raisbeck | last post by:
I have this scenario (simplified) function addnewdata () { check for partial match already in db for information entered by user if (partialmatch succeeds) { open new window aspx page (using...
9
by: Rhino | last post by:
How hard (and desireable) would it be to give the user certain choices when it comes to printing web pages? The pages on my site use colours and pictures and contain an imbedded menu, among...
4
by: RSH | last post by:
I am trying to figure out how I can trap the Closing Event that occurs when a user attempts to close the window by clicking on the red"X". I tried this code which I found online but nothing...
2
by: eclectic.01 | last post by:
I need to control the way a document is printed ... I would like a user to print a 'ticket', however, if multiple 'tickets' are selected, each ticket must be printed separately (separate piece of...
7
by: Terry Carroll | last post by:
I'm trying to use wx.ProgressBar, and the cancel button is not responding. Here is a simple program that exhibits the problem: ######################################################### import...
1
by: RLN | last post by:
RE: Access 2003 Current setup is: Front end .mdb (Interface, queries, macros, etc) /Back end .mdb (Database Tables) I'm trying to write some code that will prevent users from getting into the...
5
by: snehadulur | last post by:
In the input box if we click ok or cancel the invoice prints. By default the credit card info is 0, and most of the cases its 0 even when we want to take a print out i.e., the value is changed. I...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.