Share via


Visual Basic: CommonDialog Control

PrinterDefault Property

See Also   Example   Applies To

Returns or sets an option that determines if the user's selections in the Print dialog box are used to change the system's default printer settings.

Syntax

object**.PrinterDefault** [= value]

The PrinterDefault property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value A Boolean expression specifying whether the user's selections are used to change the system's default printer settings, as described in Settings.

Settings

The settings for value are:

Setting Description
True Any selections the user makes in the Setup portion of the Print dialog box (printer selection, orientation, and so on) are used to change the printer settings in the system's registry.
False User's selections can't be used to change the system's default printer settings.

Remarks

When PrinterDefault is True, you can write code to print directly to the Visual Basic Printer object. Otherwise, you must use the graphic device interface (GDI) calls to print to the printer specified by the control's hDC property.

Note   If you've previously printed to the Printer object, make sure you've ended that print job using Printer.EndDoc. This releases the hDC associated with that printer. You will get a new hDC for the default printer the next time you print to the Printer object. If you don't do this, it's possible for the user to select a new printer while the Printer object contains a handle to the old printer.

Data Type

Boolean