Results 1 to 3 of 3

Thread: Using wild cards in VB to find files

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476

    Angry

    Hi Team

    I'm trying to open a file using wildcards, but it doesn't work.

    I want to find a file called "5(0)23_345.bmp". But at run time all I know is the 23 of the above name.

    However I know that the 23 will always be preceded by ) and followed by _ ie:
    the 5(0) can be any value in that formate ie ?(?);
    the _345 will allways be in that format but with any number of digits, ie _*

    To find such a file t tried using the mask ????23_*
    But this does not work in VB, but does in dos

    My actual code is
    Picture1.Picture = LoadPicture ("C:\???23_*")

    I have also tried cutting this back to bare bones with

    Picture1.Picture = LoadPicture ("C:\?(0)23_*")

    But this still does not work

    However, for all you cynics who think I may be a total idiot

    Picture1.Picture = LoadPicture ("C:\5(0)23_345.bmp") does work.

    If you have any ideas or want to clarify anything I'm happy to answer questions.

  2. #2
    Addicted Member eer3's Avatar
    Join Date
    Sep 2000
    Location
    Ca
    Posts
    165

    If it were me...

    I'd use the File System Object to retrieve the full filename to a variable, then use Loadpicture with the variable.

    Hope this helps!

  3. #3
    New Member
    Join Date
    Sep 2000
    Location
    Kerala, India
    Posts
    8
    The wild card characters (? and *) are used to represent more than one file. So it is not possible to open a single file using wildcards.

    why don't you try this:

    place a FileListBox and set its Pattern property to your criteria. after that you can retrieve the name of the file from the listbox.

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