Share via


Visual Basic: CommonDialog Control

Flags Property (Print Dialog)

See Also   Example   Applies To

Returns or sets the options for the Print dialog box.

Syntax

object**.Flags** [= value]

The Flags property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
value A constant or value specifying the options for the Print dialog box, as described in Settings.

Settings

The settings for value are:

Constant Value Description
cdlPDAllPages &H0 Returns or sets the state of the All Pages option button.
cdlPDCollate &H10 Returns or sets the state of the Collate check box.
cdlPDDisablePrintToFile &H80000 Disables the Print To File check box.
cdlPDHelpButton &H800 Causes the dialog box to display the Help button.
cdlPDHidePrintToFile &H100000 Hides the Print To File check box.
cdlPDNoPageNums &H8 Disables the Pages option button and the associated edit control.
cdlPDNoSelection &H4 Disables the Selection option button.
cdlPDNoWarning &H80 Prevents a warning message from being displayed when there is no default printer.
cdlPDPageNums &H2 Returns or sets the state of the Pages option button.
cdlPDPrintSetup &H40 Causes the system to display the Print Setup dialog box rather than the Print dialog box.
cdlPDPrintToFile &H20 Returns or sets the state of the Print To File check box.
cdlPDReturnDC &H100 Returns a device context for the printer selection made in the dialog box. The device context is returned in the dialog box's hDC property.
cdlPDReturnDefault &H400 Returns default printer name.
cdlPDReturnIC &H200 Returns an information context for the printer selection made in the dialog box. An information context provides a fast way to get information about the device without creating a device context. The information context is returned in the dialog box's hDC property.
cdlPDSelection &H1 Returns or sets the state of the Selection option button. If neither cdlPDPageNums nor cdlPDSelection is specified, the All option button is in the selected state.
CdlPDUseDevModeCopies &H40000 If a printer driver doesn't support multiple copies, setting this flag disables the Number of copies spinner control in the Print dialog. If a driver does support multiple copies, setting this flag indicates that the dialog box stores the requested number of copies in the Copies property.

Remarks

These constants are listed in the Microsoft CommonDialog Control (MSComDlg) object library in the Object Browser.

You can also define selected flags. Use the Const keyword in the Declarations section of the startup form to define the flags you want to use. For example:

Const ReadOnly  = &H00000001&
Const Effects  = &H00000100&

You can set more than one flag for a dialog box using the Or operator. For example:

CommonDialog1.Flags = &H10& Or &H200&

Adding the desired constant values produces the same results. The following is equivalent to the preceding example:

CommonDialog1.Flags = &H210&

Data Type

Long