473,395 Members | 1,516 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,395 software developers and data experts.

Printdocument.PrintPage cancel current printpage

Hi, can anyone tell me how to cancel the printing of the current page while
in the Printdocument.PrintPage event. I don't want to cancel the whole
printjob!
I need this for printing only the user defined selected pages or the from/to
pages.

Coen
Jun 21 '06 #1
2 4948
The PrintPageEventArgs object's graphics object has a Clear. I believe that
just clears the current page. I've never tried this so you'll have to
experiment a bit. You might be able to just clear the page and return and
..Net will skip the page. More likely, though, you'll have to go on to your
next page routine without exitting that routine.

For your needs, though, I think it might be better to have a common routine
called for all pages. The routine would keep track of what pages have and
haven't printed and call the print routines for your pages.

Something like this....

Sub PagePrint(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs)
mnPage += 1 'higher level variable set to 0 at the start of job by
another routine
if UserWantsThisPage(mnPage) then
select case mnPage
case 1: PrintCoverPage
case 2,3,4: PrintOneOfThesePages
case 5: PrintLastPage
end select
end if
end sub
"Coen" wrote:
Hi, can anyone tell me how to cancel the printing of the current page while
in the Printdocument.PrintPage event. I don't want to cancel the whole
printjob!
I need this for printing only the user defined selected pages or the from/to
pages.

Coen

Jun 21 '06 #2
Did you try e.HasMorePages = False ?

A lot of printpage event handlers use more than one logic point to set this.
You can then 'return' from a midpoint in the printpage handler.

Coen wrote:
Hi, can anyone tell me how to cancel the printing of the current page while
in the Printdocument.PrintPage event. I don't want to cancel the whole
printjob!
I need this for printing only the user defined selected pages or the from/to
pages.

Coen

Jun 23 '06 #3

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

Similar topics

0
by: Frnak McKenney | last post by:
Evert: verb. Turn inside out; turn the inner surface of outward. The project I'm working on involves seven or eight reports. They vary from simple ("print this field here, that there, with a...
1
by: john sutor | last post by:
I am trying to print a simple document (.txt) from my drive. I tried using the following code to no avail. This cannot be that hard. In VB this was easy, Why does C# make it so hard? Can anyone...
1
by: Fei Li | last post by:
Hi, why PrintDocument.PrintPage() does not send me the current page information? Regards
1
by: Krich | last post by:
I am still new on printdocument object. I have a problem try to print graphic object. I have one graphics object. How to print it? I try to print it in PrintPage event using this syntax...
4
by: Marcos Beccar Varela | last post by:
Hello to all, I have this form with a PrintDocument named prt_doc, theproblem is that when I invoke the prt_doc.print() it only prints the las page, and not multiple pages. I Also Have a Preview...
2
by: Steve | last post by:
I'm trying real hard to set the printer resolution for a PrintDocument. It appears that the printer is already set to 300 x 300 dpi, which is JUST what I want. But the Margins and PrintableArea...
2
by: bp | last post by:
Hi, I try to use my own PreviewDialog with a PrinPreviewControl, to preview a document of type MyPrintDocument, and I want to implement the PrintRange functionnality (print some pages between 2...
1
by: kig25 | last post by:
Hello, When using the VB.NET PrintDocument class, I seem to be encountering an issue where the sub pd_PrintPage handles PrintDocument.PrintPage (upon continuing if HasMorePages = true) will...
1
by: tghamm | last post by:
Hey everyone, I'm trying to output a text file to a printer, and for some reason, it prints over itself, something that should be 15 pages can be from 4-8 pages, and it changes each time I try it. ...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.