Flags Property (File Dialogs)


Applies To

Common dialog1H1HYJI.


Sets the options for the Open and Save As dialog boxes.


[form.]CMDialog.Flags[ = flag ]


The following constants are available for the Open and Save As dialog boxes:







Specifies that the File Name list box allows multiple selections.

The user can select more than one file at run time by pressing the Shift key and using the Up and Down Arrow keys to select the desired files. When this is done, the FileName property returns a string containing the names of all selected files. The names in the string are delimited by spaces.



Specifies that the dialog box should ask if the user wants to create a file that does not currently exist. This flag automatically sets the OFN_PATHMUSTEXIST and OFN_FILEMUSTEXIST flags.



Indicates that the extension of the returned file name is different from the extension specified by the DefaultExt property. This flag is not set if the DefaultExt property is Null, if the extensions match, or if the file has no extension. This flag value can be checked upon returning from the dialog box.



Specifies that the user can enter only names of existing files in the File Name text box. If this flag is set and the user enters an invalid file name, a warning is displayed. This flag automatically sets the OFN_PATHMUSTEXIST flag.



Hides the Read Only check box.



Forces the dialog box to set the current directory to what it was when the dialog box was invoked.



Specifies that the returned file will not have the Read Only attribute set and will not be in a write-protected directory.



Specifies that the common dialog box allows invalid characters in the returned file name.



Causes the Save As dialog box to generate a message box if the selected file already exists. The user must confirm whether to overwrite the file.



Specifies that the user can enter only valid path names. If this flag is set and the user enters an invalid path name, a warning message is displayed.



Causes the Read Only check box to be initially checked when the dialog box is created. This flag also indicates the state of the Read Only check box when the dialog box is closed.



Specifies that sharing violation errors will be ignored.



Causes the dialog box to display the Help button.


These flags are defined in the Visual Basic CONSTANT.TXT file.

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 OFN_READONLY  = &H00000001&
Const CF_EFFECTS    = &H00000100&
CMDialog1.Flags = &H10& Or &H200&


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

CMDialog1.Flags = &H210&

Data Type