473,398 Members | 2,427 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,398 software developers and data experts.

PrintDialog problem

Summary: dlgPrint.PrinterSettings.Copies always returns 1 regardless of
what the user entered

Details: When trying to print a document, I am first presenting the user
with the standard PrintDialog which was declared as "dim dlgPrint as new
PrintDialog()" After it is declared but before it is shown, a few
properties are set to some defaults including "dlgPrint.AllowSomePages =
true" "dlgPrint.AllowPrintToFile = false" and "dlgPrint.showNetwork = false"
Also, the dlgPrint.document property is set to a new instance of a
PrintDocument. To invoke the dialog, I am making a standard
"dlgPrint.showDialog()" call. If the return value is DialogResult.OK then
various fields are being used successfully such as
"dlgPrint.PrinterSettings.FromPage" and "dlgPrint.PrinterSettings.ToPage".
However, trying to see how many copies the user requested by checking
"dlgPrint.PrinterSettings.Copies" will always return a value of 1, whether
they have entered a 1 or a 5 or whatever.

Question: Is this a known bug? Is there any fix or workaround? - -
OR - - Is there any code which successfully does this that I can
use/modify?

I've tried looking at Google Groups, etc. and see some minor mention of a
problem like this but couldn't find the standard official acknowledgement.

Thanks.
Nov 22 '05 #1
2 2499
Hi Mark,

Thanks for posting in the community.

According to MSDN, the PRINTDLG structure does not always contain the
correct value in its nCopies member. In some circumstances, the DEVMODE
structure will instead contain the right number of copies requested. It
depends on whether the application or the printer driver is responsible for
producing multiple copies.

From the MSDN:
"PRINTDLG.nCopies
Contains the initial number of copies for the Copies edit control if
hDevMode is NULL; otherwise, the dmCopies member of the DEVMODE structure
contains the initial value. When PrintDlg returns, nCopies contains the
actual number of copies to print. This value depends on whether the
application or the printer driver is responsible for printing multiple
copies. If the PD_USEDEVMODECOPIESANDCOLLATE flag is set in the Flags
member, nCopies is always 1 on return, and the printer driver is
responsible for printing multiple copies. If the flag is not set, the
application is responsible for printing the number of copies specified by
nCopies. For more information, see the description of the
PD_USEDEVMODECOPIESANDCOLLATE flag.

PD_USEDEVMODECOPIESANDCOLLATE
This flag indicates whether your application supports multiple copies and
collation. Set this flag on input to indicate that your application does
not support multiple copies and collation. In this case, the nCopies member
of the PRINTDLG structure always returns 1, and PD_COLLATE is never set in
the Flags member.
If this flag is not set, the application is responsible for printing and
collating multiple copies. In this case, the nCopies member of the PRINTDLG
structure indicates the number of copies the user wants to print, and the
PD_COLLATE flag in the Flags member indicates whether the user wants
collation."

Question: Is this a known bug? Is there any fix or workaround?

Yes, we do have a known bug on this, but unfortunately, it would be punted
to Longhorn Beta 1.
We are sorry for the unconvenience.

However, the workaround may be using the DEVMODE.dmCopies value if
available, otherwise to use the PRINTDLG.nCopies value.
Another possible method might be to use whichever of DEVMODE.dmCopies or
PRINTDLG.nCopies is larger - but you need to make sure that one or the
other never contain spurious >1 values.
Wish it helps!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------

Nov 22 '05 #2
Mark,
The number of copies bug was in framework 1.0 and has been corrected in
framework 1.1. My code built against 1.1 will correctly print multiple
copies if the user selects that option.
AFAIK there was no fix for this in framework v1.0.

Ron Allen
"Mark Waser" <mw****@mwaser.com> wrote in message
news:O0**************@tk2msftngp13.phx.gbl...
Summary: dlgPrint.PrinterSettings.Copies always returns 1 regardless of
what the user entered

Details: When trying to print a document, I am first presenting the user
with the standard PrintDialog which was declared as "dim dlgPrint as new
PrintDialog()" After it is declared but before it is shown, a few
properties are set to some defaults including "dlgPrint.AllowSomePages =
true" "dlgPrint.AllowPrintToFile = false" and "dlgPrint.showNetwork = false" Also, the dlgPrint.document property is set to a new instance of a
PrintDocument. To invoke the dialog, I am making a standard
"dlgPrint.showDialog()" call. If the return value is DialogResult.OK then
various fields are being used successfully such as
"dlgPrint.PrinterSettings.FromPage" and "dlgPrint.PrinterSettings.ToPage".
However, trying to see how many copies the user requested by checking
"dlgPrint.PrinterSettings.Copies" will always return a value of 1, whether
they have entered a 1 or a 5 or whatever.

Question: Is this a known bug? Is there any fix or workaround? - -
OR - - Is there any code which successfully does this that I can
use/modify?

I've tried looking at Google Groups, etc. and see some minor mention of a
problem like this but couldn't find the standard official acknowledgement.

Thanks.

Nov 22 '05 #3

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

Similar topics

2
by: aimee | last post by:
Hi. Is there a way to capture the events fired in a PrintDialog? I would like to capture when the user presses "Print" so I can do some cleanup. The asp.net (IE6) application I'm working on has 6...
3
by: John O'Neill | last post by:
Hi In C# I would like to be able to set the printer device for printing a document without using the PrintDialog. I am writing a pocket pc application which uses a web service to print. I can...
2
by: Mark Waser | last post by:
Summary: dlgPrint.PrinterSettings.Copies always returns 1 regardless of what the user entered Details: When trying to print a document, I am first presenting the user with the standard...
2
by: David | last post by:
Does anybody know how to check the AllowSelection radio button in the PrintDialog Dialog? I want to set this to checked if the user has selected a subset of text.
4
by: Steph. | last post by:
Hi, Is there a BUG in the printdialog ? When I create a PrintDialog ans set the "DefaultPageSettings.Landscape" property to "false" and then display the dialog, select "Landscape" and click OK,...
1
by: Blaine | last post by:
When I show my Windows Form as a dialog box (ShowDialog(Me)) and click on a button that calls the ShowDialog of either the PageSetupDialog or PrintDialog conrtol, my Windows Form closes After I...
0
by: Nícolas Rodrigo Santana | last post by:
I am working in an application where I use the Visio Screen, come of: "AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl" Everything this functioning correctly, but when I print this not...
4
by: mafandon | last post by:
Is it possible to send a performclick to a button on a printdialog? I know you can do an if statement similar to: if windows.forms.dialogresult.cancel then msgbox("User cancelled print...
3
Spitaki
by: Spitaki | last post by:
Hi, When I call the sub Print the PrintDialog opens twice. What do I have to change so this won't happen again? When I call the sub PrintPreview it works just fine. Has anyone an idea what I do...
2
by: Artie | last post by:
Hi, I've searched the web but can't find a solution to an apparently really simple problem. My app contains an HTML string and I need to be able to invoke the Print Dialog to print the HTML...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.