|
-
Jul 11th, 2017, 04:33 PM
#41
Re: [VB6] Unicode File Open/Save Dialog
 Originally Posted by aghamali
Hello
Can I specify the type of file attachment?
For example, we open a text file in the program and the program will encode a text file in a label
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.
Last edited by LaVolpe; Jul 11th, 2017 at 08:23 PM.
-
Jul 12th, 2017, 07:00 AM
#42
Member
Re: [VB6] Unicode File Open/Save Dialog
 Originally Posted by LaVolpe
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.
Hello
Please look at this thread and tell your opinion
This Thread
-
Jul 12th, 2017, 07:05 AM
#43
Re: [VB6] Unicode File Open/Save Dialog
 Originally Posted by aghamali
Hello
Please look at this thread and tell your opinion
Selecting a file name has nothing to do with encoding a file to UTF8 or any other encoding. Opening a file that has unicode characters in the file name is different issue and that was discussed in the 1st post of this thread.
-
Aug 6th, 2017, 09:46 PM
#44
Fanatic Member
Re: [VB6] Unicode File Open/Save Dialog
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:
Code:
.Filter = "Bitmaps|*.bmp|JPEGs|*.jpg;*jpeg|GIFs|*.gif|Meta Files|*.wmf;*.emf|Icons/Cursors|*.ico;*.cur"
I have some jpg files in my test folder, and the Dialogbox shows none of them.
I change it to this:
Code:
.Filter = "JPEGs|*.jpg;*.jpeg;*.jpe"
Then it works.
Then I change it to:
Code:
.Filter = "JPEGs|*.jpg|*.jpeg|*.jpe"
Now, this one shows only "jpg" files but files with extensions "jpeg" and "jpe" are not available for selection.
What is the general rule?
How should this Filter string be composed?
Thanks again for the wonderful job.
-
Aug 6th, 2017, 09:53 PM
#45
Re: [VB6] Unicode File Open/Save Dialog
In the sample you posted, there is a typo unfortunately
Code:
.Filter = "Bitmaps|*.bmp|JPEGs|*.jpg;*jpeg|GIFs|*.gif|Meta Files|*.wmf;*.emf|Icons/Cursors|*.ico;*.cur"
A missing period. Should be: JPEGs|*.jpg;*.jpeg
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
Last edited by LaVolpe; Aug 6th, 2017 at 10:41 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|