The open/save dialog does no encoding, it simply returns a selected file name. If you want to filter which file types the user should select, set the .Filter and .FilterIndex properties, same as you would if using the VB common dialog control.
Printable View
Hello
Please look at this thread and tell your opinion
This Thread
Hi.
The Folder Browser (moved to another thread) is very nice.
Thanks again for that wonderful job.
I am now experimenting with the File Browser (OpenSave Dialogbox) attached to post #1 in here.
I downloaded that class attached to post #1 (cOpenSaveDialog) and am testing it.
The filter specified in the example in the same post (post #1) does not work:
I have some jpg files in my test folder, and the Dialogbox shows none of them.Code:.Filter = "Bitmaps|*.bmp|JPEGs|*.jpg;*jpeg|GIFs|*.gif|Meta Files|*.wmf;*.emf|Icons/Cursors|*.ico;*.cur"
I change it to this:
Then it works.Code:.Filter = "JPEGs|*.jpg;*.jpeg;*.jpe"
Then I change it to:
Now, this one shows only "jpg" files but files with extensions "jpeg" and "jpe" are not available for selection.Code:.Filter = "JPEGs|*.jpg|*.jpeg|*.jpe"
What is the general rule?
How should this Filter string be composed?
Thanks again for the wonderful job.
In the sample you posted, there is a typo unfortunately
A missing period. Should be: JPEGs|*.jpg;*.jpegCode:.Filter = "Bitmaps|*.bmp|JPEGs|*.jpg;*jpeg|GIFs|*.gif|Meta Files|*.wmf;*.emf|Icons/Cursors|*.ico;*.cur"
I don't think any jpeg files have an extension of .jpe do they? If so, then that part of the filter would look like:
JPEGs|*.jpg;*.jpeg;*.jpe
The rule. Filters are provided in two parts, separated by vertical bar. 1st part is text displayed in the dropdown on the dialog and 2nd part is the list of extensions. If more than one extension, each extension separated by semicolon. Now multiple filters can be provided and every additional filter is appended to the previous filter with a vertical bar. Just FYI. This is the same rule that is used by the VB6 common dialog control.
Example
Filter #1: Bitmaps|*.bmp
Filter #2: JPEGs|*.jpg;*.jpeg
Combining both filters with vertical bar: Bitmaps|*.bmp|JPEGs|*.jpg;*.jpeg
Also note that the filter doesn't have to be extensions. Let's say I have an app that creates log files with a naming format like: ActivityPeriod_yyyymm.log and wanted to load those via the filter. Then my filter might look like this: Activity Logs|ActivityPeriod_*.log|All Logs|*.log|All Files|*.*
Edited. Thanx for pointing out that typo. I corrected the sample code in post #1