Select Case Question

  • Thread starter Thread starter Elmo Watson
  • Start date Start date
E

Elmo Watson

Based on a filename (var: sFilename), I need to check it, via a Select
statement, for certain letter combinations
Here's what I've got that's not working:
Select Case sFilename
Case sFilename.ToUpper.Contains("xxxxxx")
' then output here
End Select

I have double verified, through quickwatch, that the 'contains' portion
truely is in the filename - it shows as true
I've even added "=true" to the end [Case
sFilename.ToUpper.Contains("xxxxxx")=true]

In debug mode, it still skips right past the 'output' section, as if it was
false.....

Is there a different way I should be doing this?
 
Elmo Watson said:
Based on a filename (var: sFilename), I need to check it, via a Select
statement, for certain letter combinations
Here's what I've got that's not working:
Select Case sFilename
Case sFilename.ToUpper.Contains("xxxxxx")
' then output here
End Select

The value contained in 'sFileName' is not equal to 'True', which 'Contains'
returns. You'll have to use 'Select Case True'.
 
Back
Top