TextBox1.Text = FolderBrowserDialog1.SelectedPath If FolderBrowserDialog1.ShowDialog() = DialogResult.OK Then This example assumes a form with a FolderBrowserDialog component and a TextBox control. It is a good idea to place the location in an editable area, such as a TextBox control, so that users may edit their selection in case of error or other issues. In this example, the folder name is then displayed in a TextBox control on the form. In the example below, the FolderBrowserDialog component is used to select a folder, similar to when you create a project in Visual Studio and are prompted to select a folder to save it in. If you need to set the top-most folder that will appear within the tree view of the dialog box, set the RootFolder property, which takes a member of the Environment.SpecialFolder enumeration.Īdditionally, you can set the Description property, which specifies the text string that appears at the top of the folder-browser tree view. In a procedure, check the FolderBrowserDialog component's DialogResult property to see how the dialog box was closed and get the value of the FolderBrowserDialog component's SelectedPath property. To choose folders with the FolderBrowserDialog component
The Windows Forms FolderBrowserDialog component allows you to easily accomplish this task. SkinnableWide and SkinnableCompact - these values are available for the Open Folder behavior only and allow you to choose between the “Wide” and “Compact” dialog styles (see the XtraFolderBrowserDialog.Often, within Windows applications you create, you will have to prompt users to select a folder, most frequently to save a set of files.Skinnable - the target control invokes skinnable DevExpress dialogs.Standard - the target control invokes default Visual Studio FolderBrowser dialogs.DialogStyle - allows you to choose the dialog type and style:.ShowIcon, IconSize, InvalidPathImage - same as for the File Icon Behavior.Mode - specifies whether the auto-complete feature proposes only folder paths, only file paths or both of them in the attached editor.The path and the icon of the object selected in this dialog are then shown by the editor. The editor button invokes a dialog that allows you to select a file or a folder, depending on which behavior you have attached. These behaviors instantly turn your editor into a file or a folder selector. For example, if this property is set to “Windows\Globalization\Time Zone”, browsing the folder hierarchy on a system disc drive will instantly bring end-users to this folder. The Windows Forms FolderBrowserDialog component is a modal dialog box that is used for browsing and selecting folders. Filter - allows you to narrow auto-complete hints to a specific folder or file. Introduction to the Windows Forms FolderBrowserDialog Component.Mode - specifies whether the auto-complete feature proposes only folder paths, only file paths or both of them.IconSize, InvalidPathImage - same as for the File Icon Behavior.To navigate through proposed auto-complete options, end-users can press Tab. Once a valid path is entered, its icon is displayed next to the editor’s text. Using this feature end-users can quickly enter file and/folder paths. Provides an auto-complete feature for the editor this behavior is attached to. The assigned image is shown as is and does not scale in accordance to the IconSize setting. InvalidPathImage - an icon that will be displayed when the target control does not display a valid file (folder) path.
To display icons of other sizes, turn the RepositoryItem.AutoHeight property off and increase the editor’s height by using the Size property. The default height of text box editors equals 20 pixels, which allows them to display only small icons. IconSize - allows you to select the required size for file (folder) images: small, medium, large or extra large. If you key in a path, the folder gets activatied. If you click a folder in the GUI, the path appears in the textbox. You can browse for computers or printers with it. You can browse for folders, or files+folders. ShowIcon - enables or disables the behavior. This one allows you to type in a path, even a UNC path.The following figure illustrates multiple label controls with this behavior attached to them. This behavior checks the displayed text of a target control and if this text is a path to an existing file or folder, adds its icon to the control. Do not attach, for instance, a File Path Behavior to ButtonEdit if this editor already has the Open File Behavior attached. Note that each behavior inherits the preceding behavior’s features on this list.
This document gathers multiple similar behaviors that solve various tasks related to browsing and selecting files and folders.