次の方法で共有


Printer.Copies Property

Gets or sets a value that determines the number of copies to be printed.

Namespace:  Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
Public Property Copies As Short
public short Copies { get; set; }
public:
property short Copies {
    short get ();
    void set (short value);
}
member Copies : int16 with get, set
function get Copies () : short 
function set Copies (value : short)

Property Value

Type: System.Int16
A Short representing the number of copies to be printed.

Remarks

If the PrintAction property is set to a value other than PrintToPrinter, this property is ignored.

If the Copies property is set to a value that is less than 1, a run-time exception occurs.

If you set this property after you call the Print, Circle, Line, or PSet methods on a new page, a run-time exception occurs.

Note

Functions and objects in the Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 namespace are provided for use by the tools for upgrading from Visual Basic 6.0 to Visual Basic. In most cases, these functions and objects duplicate functionality that you can find in other namespaces in the .NET Framework. They are necessary only when the Visual Basic 6.0 code model differs significantly from the .NET Framework implementation.

Examples

The following example demonstrates how to set the Copies property. It assumes that you have a TextBox named txtCopies that is used at run time to determine the number of copies to print.

Dim pr As New Printer
Dim numCopies As Short
numCopies = CShort(txtCopies.Text)
pr.Copies = numCopies
pr.Print("Hello")
pr.EndDoc()

.NET Framework Security

See Also

Reference

Printer Class

Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6 Namespace

Other Resources

Printer Compatibility Library

How to: Fix Upgrade Errors by Using the Printer Compatibility Library (Visual Basic)

Deploying Applications That Reference the Printer Compatibility Library