-
Nov 2nd, 2000, 05:30 AM
#1
Thread Starter
Member
Hi,
I'm using a filelistbox to display files. I have the property pattern set to "*.atl" to only list atl-files. My problem is that even with that property set files like test.atl% and test.atl~ is listed.
Why is that and how can I only list files that are of filetype .atl
-
Nov 2nd, 2000, 07:24 AM
#2
_______
<?>
* is a wild card and selects all things like alt whether they have 3,4,5 or whatever characters for their extesions.
One around it would be to use a list box instead of a file box, read the folder, and only list anything with alt and 3 characters following the decimal.
Code:
'this will get the job done
Option Explicit
Private Sub Form_Load()
'access all files within a folder
Dim stFile As String
Dim stDir As String
Dim myExt As String
Dim myPos As Integer, myChar As String
Dim myLen As Integer
myChar = "."
stDir = "C:\My Documents\"
stFile = Dir$(stDir & "*.atl")
Do While stFile <> ""
'myPos = the count to the decimal
myPos = InStr(1, stFile, myChar, 1)
'mylen = length of the filename
myLen = Len(stFile)
'my extension is what is left when we subtract
'the string lenght from the position
myExt = Right(stFile, myLen - myPos)
'if the extension is of 3 characters let it pass
If Len(myExt) = 3 Then
List1.AddItem stFile
stFile = Dir
'else just go to next ifle
Else
stFile = Dir
End If
Loop
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 2nd, 2000, 07:42 AM
#3
Lively Member
Another Thought ....
I use the file list box thnigy for patterns of *.log.
I've just tried to recreate Jess' problem and I can't. As soone as some char is added on the log the file gets ignored.
Don't know if this means there's a problem with my program or something wrong with yours ???
Just thought I would let you know. Something else to ponder while wanting to break the computer!
H.
-
Nov 2nd, 2000, 07:55 AM
#4
Thread Starter
Member
Hollie,
I don't have any problems with files named like "test.atl5" or files that ends with other extensions with more than 3 characters unless the fourth character is % or ~
Could you please see if you can see files like test.atl%.
I'm also looking into HeSaidJoe's suggestion, to see how much longer it might take to load the files that way.
Thanks for the help.
-
Nov 2nd, 2000, 08:00 AM
#5
Lively Member
your answer
Did as you asked...
My program is still only showing the .log files and ignoring .log% and .log~
I'm starting to get worried now
H.
-
Nov 2nd, 2000, 08:18 AM
#6
Thread Starter
Member
Hollie,
Thanks for trying.
I'm getting confused.
What version and SP are you using?
I'm using VB6
and the file Msvbvm60.dll has the fileversion: 6.00.8495, which according to MS should be SP 3. Have you updated to SP 4?
Plese stay with me on this one!
-
Nov 2nd, 2000, 08:28 AM
#7
_______
<?>
I use sp4 and vb6
If I have 2 files htm and html and use *.htm I get both
and the same for atl~ and atl%
Remember, if you are going to notepad and saving a file as
atl~ or atl% or atl you must enclose it in "myfile.atl" for it to receive the proper extension else if you just change a name you will get myfile.atl.txt and then it won't show because it is a text file.
Plus I just retested it using sp3 and it's the same.
[Edited by HeSaidJoe on 11-02-2000 at 08:30 AM]
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 2nd, 2000, 08:48 AM
#8
Thread Starter
Member
OK, I finally understand what is going on, the wild character * means that all files are listed as long as the .atl is part of the name. When I extended my test I realized it dosn't matter how many characters that the extension exist of, they will all be listed as long as it match.
I did my test by changing the filnames, not saving the files with another name through a notepad or such.
So now when you have convinst me I'm going to follow the first suggestion HeSaidJoe gave me.
Thanks alot for all your help!
-
Nov 2nd, 2000, 08:53 AM
#9
Lively Member
Well I've been using VB6 and SP3.
Methinks I'll need to look into my code a bit more and find out why my progran is behaing differently.
I'll also have a lookie at Joe's code as well.
Sorry I couldn't help.
H.
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
|