PrinterSettings.ToPage Property

Definition

Gets or sets the number of the last page to print.

public:
 property int ToPage { int get(); void set(int value); };
public int ToPage { get; set; }
member this.ToPage : int with get, set
Public Property ToPage As Integer

Property Value

The number of the last page to print.

Exceptions

The value of the ToPage property is less than zero.

Remarks

The FromPage and ToPage properties are used by the PrintDialog when the user selects a print range. The PrintDialog.AllowSomePages property must be set to true to enable the user to specify a print range. In addition, the PrintDialog also requires the MinimumPage and MaximumPage to be specified and the ToPage value to be within that range.

During the printing process, in the PrintDocument.PrintPage event, view the PrintRange to determine what should be printed. If PrintRange is PrintRange.SomePages, use the FromPage and ToPage properties to determine what pages should be printed. If PrintRange is PrintRange.Selection, then specify output only for the selected pages.

The FromPage, ToPage and PrintRange can also be set programmatically, though the PrintDocument.PrintPage implementation is the same.

Applies to

See also