Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problem on file patterns

Problem on file patterns

Problem on file patterns

I need to use this "*R.xxx" file pattern, but the file list box didn't give me only the files that matched the pattern, it gave me all the files ending with .xxx, so Where is de *R ?, Help me. I'm from argentine and i prefer to read i spanish if it's possible. Thanks.

RE: Problem on file patterns


Sorry, cannot oblige your request for Spanish. About all I know is 'Hola' y 'digame'.

Long time since I worked with a file mask in VB, but I think that using the '*' in front of the 'R' conceals the 'R' from VB's limited file access capability. I'll do some testing to be certain, and let you know what I find. Also want to go back and look at an _old_ project (VB 2.0) to see if this has changed.

Manana, mas o menos.

RE: Problem on file patterns


I just tried both the Drive, Dir, File controls and the DIR$ Function. Had a good return on both. Maybe you could provide a sample of the code you are using for us to see? Maybe some other thing is causing a probelm.

Make a good day . . .

RE: Problem on file patterns

Here I send you the part of the code where I found the problem,

File1.Path = b$
File1.Pattern = "*R.QXD"
c = File1.ListCount
If (c) Then
For p = 0 To c - 1
Kill b$ + "\" + UCase$(File1.List(p))
Registra_DepuraciĆ³n ("Borrado de (*R.QXD)")
Next p
End If

Thanks for all you are doing,

Have a nice week. Orcho.

RE: Problem on file patterns


I apologize for being late - I thought I had responded to this, but I think a power problem killed my response, and I did not come back to check - mea culpa.

The only thing I see that might be a problem in the code above is that the 'Kill" line will fail if b$ is the root of a drive, e.g. "C:\". You might want to preface the statement with

If Right$(b$,1)<>"\" then
b$ = b$ & "\"
End If
then issue the Kill statement

However, there is one other item, which you have probably found by now if it is a problem. Should
be changed to

Otherwise, b$ is not set, unless in code previous to this.

RE: Problem on file patterns

Doing *R.QXD will not work on all operating systems. The Dir$ command is just passed along to the operating system. I think Windows 95 OSR2 and up will support this feature.

David Finkelstein
http://www.codeoftheweek.com - The source for Visual Basic Source Code

RE: Problem on file patterns

One more thing. If you know that the filename is always eight characters you can do this:


and that should return the files you want in all operating systems (even all the way back to DOS 4.0).

RE: Problem on file patterns

Actually I save the problem whit an Instr command, asking for "R.", in the path string. It works very good.

Thanks for all you've done. Orcho

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close