Selecting a file
This exercise describes how to add a FilePicker to a form:
- Click and drag a FilePicker from the Toolbox to the Design Sheet:
Resize
Click and drag the corners of the control to resize the control.
Reposition
Click and drag the handle (top-left) to reposition the control.
- You can filter the list of files you want to select based on file extension groups. For example, you might choose to suggest two image file formats as the most likely file selection, but also allow the selection of an image file with any file extension. In this case, the filter format is:
- Each file extension group comprises a file prompt, a pipe separator (|), and a semi-colon-delimited list of file extensions which should match the file extensions you have shown in the file prompt.
- Each file extension group is separated by a pipe (|) separator.
- Add a label that prompts the user to select a file:
Image files (*.bmp, *.jpg)|*.bmp;*.jpg|All files (*.*)|*.*
Note:
- Save your changes and click Run to run the form:
- Click on the ellipsis button to select a file:
- The filter you defined is shown as a drop-down menu:
- The file window is filtered based upon the file extension group you have selected: