The code below works, I can’t help thinking there is a better way to do this though. Is anyone experienced with using functions in conjunction with Select Statements.
The code I would expect to work would be something along the lines…
Select Case File.EndsWith()
Case "example 1", Case "example2"
This code works:
Select Case File.EndsWith(File)
Case tFile.EndsWith("FileA.doc")
sbExisting.AppendLine(Report.sbStart.ToString)
sbExisting.AppendLine(Report.sbHeaders.ToString)
sbExisting.AppendLine(Report.sbItems.ToString)
sbExisting.AppendLine(Report.sbSubreport.ToString)
sbExisting.AppendLine(Report.sbEnd.ToString)
sbExisting.AppendLine(Report.sbCol.ToString)
Case tFile.EndsWith("FileB.doc")
'Slave
sbExisting.AppendLine(Report.sbStart.ToString)
sbExisting.AppendLine(Report.sbItems.ToString)
sbExisting.AppendLine(Report.sbHeaders.ToString)
sbExisting.AppendLine(Report.sbCol.ToString)
sbExisting.AppendLine(Report.sbEnd.ToString)
End Select
.EndsWith()returns true or false. That’s all you have.If you do want to use
Selectwith that, then the idiomatic way isHaving multiple choices on the same line would be of not much difference:
If you already have a list of choices in an array/list/collection, you can also use
Or do the same inline if you prefer: