System.Windows.Forms 1.0.5000.0 2.0.0.0 System.Windows.Forms.CommonDialog System.ComponentModel.DefaultEvent("FileOk") System.ComponentModel.DefaultProperty("FileName") is an abstract class that contains common behavior for the and classes. It is not intended to be used directly but contains common behavior for those two classes. You cannot create an instance of . Although the class is declared public, you cannot inherit from it, as it contains internal abstract methods. To create a dialog box to select or save a file, use or . is a modal dialog box; therefore, when shown, it blocks the rest of the application until the user has chosen a file. When a dialog box is displayed modally, no input (keyboard or mouse click) can occur except to objects on the dialog box. The program must hide or close the dialog box (usually in response to some user action) before input to the calling program can occur. When you use classes derived from , such as and , avoid using string literals containing absolute paths. Instead, dynamically obtain the path using one or more of the techniques described in the following table. If you want to enable users to select a folder instead of a file, use the . Depending upon the type of application, how data associated with the application is stored, and the reason for accessing the file system, there are many possible ways in which you can create a directory path. The following table shows the techniques for creating paths dynamically. Path or program category Class and members to use Standard Windows paths, such as Program Files, MyDocuments, the Desktop and so on The class is the most complete source for these, either through its static methods, such as , or through the method, using one of the enumerated values. Paths related to the current application The class has static members to obtain certain paths, such as , , , and . The method of the returns the path of the temporary folder. The method of the class returns the application's current executing directory. The property of the class represents the specified drive's root directory. Paths stored as application settings Access the corresponding applications settings property of the wrapper class derived from . For more information, see Application Settings for Windows Forms. Registry storage Some applications store directory information in the registry. The class has the and properties that resolve to a value. ClickOnce applications For ClickOnce applications, use class members such as , which will return a pointer to the ClickOnce data directory. For more information, see Accessing Local and Remote Data in ClickOnce Applications. International applications For international applications, retrieve the relative path portion from a string resource in your application by using the class. For more information about globalization and localization, see the topic Encoding and Localization. Notice that a full path may be built up using one or more of the described techniques. For example, the method might be used to obtain the path to the MyDocuments folder, then an application setting may be used to add a relative subdirectory portion. The class contains static members to assist in manipulating absolute and relative path strings, whereas the and classes have static members that actually manipulate files and directories, respectively. If the user of your application changes the folder in the , then the current working directory for your application is set to the location specified in the . To prevent this, set the property to true. Displays a dialog box from which the user can select a file. Property System.ComponentModel.DefaultValue(true) System.Boolean To be added. The extension added to a file name depends on the currently selected file filter and the value of the property. If the property is true, the dialog box adds the first extension from the current file filter that matches an existing file. If no files match the current file filter, the dialog box adds the extension specified in the property. If the property is false, the dialog box adds the first valid file name extension from the current file filter. If the current file filter contains no valid file name extensions, the dialog box adds the extension specified in the property. Gets or sets a value indicating whether the dialog box automatically adds an extension to a file name if the user omits the extension. 1.0.5000.0 2.0.0.0 Property 2.0.0.0 System.ComponentModel.DefaultValue(true) System.Boolean To be added. If this property is false, the class will have a winxp-style appearance and behavior on wiprlhext. On winxp, this property does not have any effect. Gets or sets a value indicating whether this instance should automatically upgrade appearance and behavior when running on wiprlhext. Property System.ComponentModel.DefaultValue(false) System.Boolean To be added. The default value is true for an inheriting and false for an inheriting . Gets or sets a value indicating whether the dialog box displays a warning if the user specifies a file name that does not exist. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(true) System.Boolean To be added. To be added. Gets or sets a value indicating whether the dialog box displays a warning if the user specifies a path that does not exist. 1.0.5000.0 2.0.0.0 Property 2.0.0.0 System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.Browsable(false) System.Windows.Forms.FileDialogCustomPlacesCollection To be added. On winxp, this property does not have any effect. Gets the custom places collection for this instance. Property System.ComponentModel.DefaultValue("") System.String To be added. When the user of your application specifies a file name without an extension, the appends an extension to the file name. The extension that is used is determined by the and properties. If a filter is selected in the and the filter specifies an extension, then that extension is used. If the filter selected uses a wildcard in place of the extension, then the extension specified in the property is used. Gets or sets the default file name extension. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(true) System.Boolean To be added. To be added. Gets or sets a value indicating whether the dialog box returns the location of the file referenced by the shortcut or whether it returns the location of the shortcut (.lnk). 1.0.5000.0 2.0.0.0 Field System.Object To be added. Owns the event. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue("") System.String To be added. The file name includes both the file path and the extension. If no files are selected, this method returns an empty string (""). When used from the class, this property represents the file being saved; when used from the class, it represents the file being opened. This property can only be the name of one selected file. If you want to return an array containing the names of all selected files in a multiple-selection dialog box, use . Gets or sets a string containing the file name selected in the file dialog box. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden) System.ComponentModel.Browsable(false) System.String[] To be added. Each file name includes both the file path and the extension. If no files are selected, this method returns an empty array. Gets the file names of all selected files in the dialog box. 1.0.5000.0 2.0.0.0 Event System.ComponentModel.CancelEventHandler For information about handling events, see Consuming Events. Occurs when the user clicks on the Open or Save button on a file dialog box. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.Localizable(true) System.ComponentModel.DefaultValue("") System.String To be added. For each filtering option, the filter string contains a description of the filter, followed by the vertical bar (|) and the filter pattern. The strings for different filtering options are separated by the vertical bar. The following is an example of a filter string: Text files (*.txt)|*.txt|All files (*.*)|*.* You can add several filter patterns to a filter by separating the file types with semicolons, for example: Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.* Use the property to set which filtering option is shown first to the user. Gets or sets the current file name filter string, which determines the choices that appear in the "Save as file type" or "Files of type" box in the dialog box. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(1) System.Int32 To be added. Use the property to set which filtering option is shown first to the user. You can also use the value of after showing the file dialog to perform special file operations depending upon the filter chosen. The index value of the first filter entry is 1. Gets or sets the index of the filter currently selected in the file dialog box. 1.0.5000.0 2.0.0.0 Method System.IntPtr A hook procedure allows the user to connect or insert other routines into a routine or application for the purpose of debugging or enhancing functionality. By default, the hook procedure centers the dialog box on the screen in response to a WM_INITDIALOG message. Defines the common dialog box hook procedure that is overridden to add specific functionality to the file dialog box. Returns zero if the default dialog box procedure processes the message; returns a nonzero value if the default dialog box procedure ignores the message. The handle to the dialog box window. The message received by the dialog box. Additional information about the message. Additional information about the message. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue("") System.String To be added. The property is typically set using one of the following sources: A path that was previously used in the program, perhaps retained from the last directory or file operation. A path read from a persistent source, such as an application setting, a or a string resource in the application. Standard Windows system and user paths, such as Program Files, MyDocuments, MyMusic, and so on (which you can obtain using the method) A path related to the current application, such as its startup directory (which you can obtain using properties on the object). For more information about creating dynamic paths, see the class overview. On wiprlhext, if  is set to a full file name instead of just a directory path, the initial directory will default either to the application path, or to the directory from which the user last selected a file. Gets or sets the initial directory displayed by the file dialog box. 1.0.5000.0 2.0.0.0 Property System.IntPtr To be added. To be added. Gets the Win32 instance handle for the application. 1.0.5000.0 2.0.0.0 Method System.Void To be added. Raises the event. A that contains the event data. 1.0.5000.0 2.0.0.0 Property System.Int32 To be added. The property corresponds to the flags used to initialize a file dialog box using Win32. Use the properties of the class to get and set the options. Gets values to initialize the . 1.0.5000.0 2.0.0.0 Method System.Void To be added. Resets all properties to their default values. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(false) System.Boolean To be added. To be added. Gets or sets a value indicating whether the dialog box restores the current directory before closing. 1.0.5000.0 2.0.0.0 Method System.Boolean This method provides an implementation of , and is invoked when the user of a file dialog invokes . In the derived classes and an invalid file name can be raised. Specifies a common dialog box. true if the file could be opened; otherwise, false. A value that represents the window handle of the owner window for the common dialog box. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(false) System.Boolean To be added. A event is raised when the user clicks the Help button. Gets or sets a value indicating whether the Help button is displayed in the file dialog box. 1.0.5000.0 2.0.0.0 Property 2.0.0.0 System.ComponentModel.DefaultValue(false) System.Boolean To be added. Sometimes users must open and save files that use multiple file name extensions. For example, the application manifest files used by the ndptecclick deployment technology end in the complex file name extension ".exe.manifest". Setting this property to true enables you to set the property to a multi-dotted extension. If is false, and you assign a multi-dotted extension to , derived controls such as will only use the last extension in the string. For example, ".manifest" will be used instead of ".exe.manifest". Gets or sets whether the dialog box supports displaying and saving files that have multiple file name extensions. Property System.ComponentModel.Localizable(true) System.ComponentModel.DefaultValue("") System.String To be added. The string is placed in the title bar of the dialog box. If the title is an empty string, the system uses a default title, which is either "Save As" or "Open". Gets or sets the file dialog box title. 1.0.5000.0 2.0.0.0 Method System.String To be added. Provides a string version of this object. A string version of this object. 1.0.5000.0 2.0.0.0 Property System.ComponentModel.DefaultValue(true) System.Boolean To be added. If the edit control contains anything but spaces when the user clicks OK, the dialog box returns the file name, whether it is valid or not. No default extension is added to the text. Gets or sets a value indicating whether the dialog box accepts only valid Win32 file names. 1.0.5000.0 2.0.0.0