Results 1 to 6 of 6

Thread: anyway for a user to supply a wildcard?

  1. #1

    Thread Starter
    Lively Member fujiyama17's Avatar
    Join Date
    Aug 2000
    Location
    Columbus, OH
    Posts
    91

    Exclamation

    I am looking for a way that a user can supply a wildcard to define certian files that he/she wants from a directory. dlgCommonDialog.ShowOpen allows the user to choose one file, BUT how does the user supply a wildcard so that, for example, they can choose every *.txt file within a directory? dlgCommonDialog.ShowOpen only allows one file and no wildcards. Could there be a varible or a command that I can add to dlgCommonDialog.ShowOpen to allow wildcards to be accepted? Or is there something else. If you could help me, that would be wonderful!!! THANKS!

    ~Brian Schwartz
    [email protected]

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Sure just add the cdlOFNNoValidate flag option:
    Code:
    With CommonDialog1
        .Flags = cdlOFNNoValidate '+ other flag values you want to set
        .ShowOpen
        MsgBox .FileName
    End With
    Good luck!

  3. #3
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    You can allow the user to specify multiple files by using the cdlOFNAllowMultiselect flag. Specifies that the File Name list box allows multiple selections.
    The user can select more than one file at run time by pressing the SHIFT key and using the UP ARROW and DOWN ARROW keys to select the desired files. When this is done, the FileName property returns a string containing the names of all selected files. The names in the string are delimited by spaces.
    Code:
    With CommonDialog1
        .Flags = cdlOFNAllowMultiselect '+ other flag values you want to set
        .ShowOpen
        MsgBox .FileName
    End With
    "It's cold gin time again ..."

    Check out my website here.

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yes setting the cldOFNAllowMultiselect flag will permit you to select several files in the CommonDialog control but it doesn't allow you to type in wildchars.

  5. #5

    Thread Starter
    Lively Member fujiyama17's Avatar
    Join Date
    Aug 2000
    Location
    Columbus, OH
    Posts
    91
    Thank you for your help! It has helped me do more with the common dialog box, and perform the things that I want to do. Can I use both flags though? The cdlOFNAllowMultiselect and the cdlOFNNoValidate ... can they be used at the same time?

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yes you can just add them together.
    Code:
    CommonDialog1.Flags = cdlOFNAllowMultiselect + cdlOFNNoValidate

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