Page 2 of 2 FirstFirst 12
Results 41 to 45 of 45

Thread: [VB6] Unicode File Open/Save Dialog

  1. #41

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [VB6] Unicode File Open/Save Dialog

    Quote Originally Posted by aghamali View Post
    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  2. #42
    Member
    Join Date
    Jul 2017
    Posts
    46

    Re: [VB6] Unicode File Open/Save Dialog

    Quote Originally Posted by LaVolpe View Post
    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

  3. #43

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [VB6] Unicode File Open/Save Dialog

    Quote Originally Posted by aghamali View Post
    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #44
    Fanatic Member
    Join Date
    Mar 2010
    Posts
    844

    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.

  5. #45

    Thread Starter
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width