This control is a combination of file / folder select dialog and textbox which allow user to select file / folder by either one of the following method:
- Select file / folder from open file dialog / folder browse dialog.
- Enter file / folder path into text box.
- Drag and drop file / folder from Window Explorer.
MotivationThese controls is created to simplify GUI design in Windows Forms application where file / folder select is widely use in each project. With this control, it eliminates the need to rewrite / copy the same piece of code again and again. Moreover, all projects that utilize this controls will get instant upgrade in future with new released assemblies without recompilation.
UsageIn general, both of this controls is ready to work once you dropped in on the Form.
Some additional touch will make it even better.
- Description of control is accessible from Text property.
- Subscribe to TextChanged event to get notify when the content of text box changed.
- Get selected directory from SelectedPath property. -- FolderBrowsePanel
- Get selected file from SelectedFile property. -- OpenFilePanel
OpenFilePanelAdditional properties for OpenFilePanel which direct link to OpenFileDialog:
- FileFilter = OpenFileDialog.Filter.
- VerifyFileName = OpenFileDialog.CheckFileExists
- VerifyPath = OpenFileDialog.CheckPathExists