FilenameBox
C# Windows Forms Control for choosing a file, consisting of a TextBox where a file path can be entered and a button that brings up an OpenFilenameDialog.
Namespace
Hierarchy
- System.Object
- System.Windows.Forms.UserControl
- au.util.comctl.FilenameBox
- System.Windows.Forms.UserControl
Usage
FilenameBox is useful in configuration user interfaces where a path to a file needs to be set.
Events
Changed
FileChangedHandler Changed
The Changed event is fired when the selected file changes. (When one of the following happens:)
- The Filename property is changed
- The FileFullname property is changed
- A file is chosen via the selection dialog
- A file is typed into the TextBox
Public Properties
Filename
string Filename
Currently selected file. This is what’s displayed in the TextBox, and may be a relative path. It’s generally better to use FileFullname when setting the file.
FileFullname
string FileFullname
Full path to currently selected file. This may be different from what’s displayed in the TextBox as it is always an absolute path.
AutoCompleteMode
AutoCompleteMode AutoCompleteMode
Gets or sets an option that controls how automatic filename completion works. Is a passthrough for TextBox.AutoCompleteMode but also sets the source to FileSystem if the mode is anything but None.
BasePath
string BasePath
Starting point for file selection. When the file selection dialog comes up, it will start in this directory.
StripBasePath
bool StripBasePath
Whether the base path should be displayed to the user and returned with the Filename property.
LimitBase
bool LimitBase
Whether the selection should be limited to files within the base path. This is forced to true when StripBasePath is true.
Filter
string Filter
Gets or sets the current file name filter string, which determines the choices that appear in the "Files of type" box in the open file dialog. Is a pass-through for OpenFileDialog.Filter.
Title
string Title
Gets or sets the open file dialog box title. Is a pass-through for OpenFileDialog.Title.
FlatButton
bool FlatButton
Gets or sets whether the button will appear flat.
FileExists
bool FileExists
Whether the selected file exists. Read-only, and does not show in Visual Studio’s properties window.