Is there a way to exclude types in the filter in a filelistbox?
like <> *.log ?
Printable View
Is there a way to exclude types in the filter in a filelistbox?
like <> *.log ?
Wouldn't is be simpler to just include what you do want?
no.. I need ALL but *.log
so.. my thinking is that would be a LOOONG filter string
Well, File1.Pattern throws up all over the place if you try a put anything on it except an equal sign.
I don't know what the common dialog would do. I'll test it out and see what happens.
.. needs to be a listbox..
I'll just use a reg one an add to it as I loop through the files.. (I guess)
Quote:
Originally Posted by [A51g]Static
You are confusing me. Are you using a filelistbox or a listbox?Quote:
Originally Posted by [A51g]Static
I was using a FileListBox... but If I switch to a reg listbox I can filter them out myself
You can also filter using a filelistbox. eg:
VB Code:
File1.Pattern = "*.log;*.mdb"
So, is this fixed or are you still having a problem?Quote:
Originally Posted by [A51g]Static
yep go it working... thanks
For VB6 we had to switch to a ListView in place of FileList to get a solution ... here's the code:
Code:' get the list of excluded files
Private Sub GetExcludedFiles(ByVal fileSelFile As ListView)
Dim i As Long, names() As String
names() = GetFiles("*.*")
For i = 1 To UBound(names)
tmp2 = LCase$(GetExtension(names(i)))
If Not ((tmp2 = "exe") Or (tmp2 = "exp") Or (tmp2 = "obj") _
Or (tmp2 = "for") Or (tmp2 = "lst") Or (tmp2 = "xmp") Or (tmp2 = "sld") _
Or (tmp2 = "fc") Or (tmp2 = "fc0") Or (tmp2 = "graf") Or (tmp2 = "demo") _
Or (tmp2 = "inc") Or (tmp2 = "bat") Or (tmp2 = "ktl") Or (tmp2 = "eer") _
Or (tmp2 = "doc") Or (tmp2 = "rtf") Or (tmp2 = "jpg") Or (tmp2 = "gif") _
) Then
With fileSelFile.ListItems.Add(, , names(i)).ListSubItems
End With
End If
Next
OptimalDesigns, the original poster had already found the solution to their problem and while you have suggested another solution to the problem the original poster posted the nine years ago.