// ********** ********** ********** **********
// Add only file matching image extension
// Start with the list of items to ignore
// Then Check what I want and store if OK
Select Case img_FI
// Ignore Cases
Case img_FI.IsAlias
Case img_FI.IsFolder
Case Not img_FI.Visible
Case img_FI.Name.Left(1) = "."
// Take Cases
Case img_FI.Name.InStr(".gif.jpg.jpeg.pdf.png.tif.tiff.webp") > 0
Names_List.Add img_FI.Name
Else
// Let these in the Vaults
End Select
The error lies in the Select Case Img_FI line
The errors from the Debuger:
I Commented the Select Case lines and add it using an If …/… Else …/… End If block.
I add two System.DebugLog with the name of the tested file (and append " - Rejected" on the Else line).
None was selected !
I try to sleep now.
Compiles Now, but nothing is added into pNames_List() as in the if block…
Select Case img_FI
// Ignore Cases
Case img_FI.IsAlias
Case img_FI.IsFolder
Case Not img_FI.Visible
…
As Eric points out, you probably want Select Case True
What you are essentially writing is
Select Case img_FI
// Ignore Cases
Case img_FI.IsAlias // Is it true that: img_FI.IsAlias = img_FI
Case img_FI.IsFolder // Is it true that: img_FI.IsFolder = img_FI
Case Not img_FI.Visible // Is it true that: Not (img_FI.Visible) = img_FI
…
Of course, none of these things are true and, in fact, asking if they are equal does not really make any sense.
Var f As FolderItem = SpecialFolder.Desktop.Child("Virtual Desktop.txt")
Select Case f.Extension.Lowercase
Case "txt","jpg"
System.DebugLog f.Extension
Case Else
End Select
I guess you wanted to process something like this:
// valid file?
If img_FI <> Nil And _
Not img_FI.IsAlias And _
Not img_FI.IsFolder And _
img_FI.Visible And _
img_FI.Name.Left(1) <> "." And _
img_FI.Exists Then
// proper image?
Const imgExts As String = ".gif.jpg.jpeg.pdf.png.tif.tiff.webp."
If imgExts.IndexOf("."+img_FI.Extension.Lowercase+".") >= 0 Then
// DoWhatever(img_FI)
Else // Vault cases
// Vault(img_FI)
End
End