Hello,
Is there a quick way to mix the Select Case statement with string.Contains()?
For example: I will have a select case , but the values at each case will be parts of the original value.
It can be at all positions in the string.
Serialnumber with a A in it do sub A
Serialnumber with a B in it do Sub B
Sure I can do this by multiple If strSerial.Contains("A") Then ..... End If but I think it can be done smarter.
Best Regards
Is there a quick way to mix the Select Case statement with string.Contains()?
For example: I will have a select case , but the values at each case will be parts of the original value.
It can be at all positions in the string.
Serialnumber with a A in it do sub A
Serialnumber with a B in it do Sub B
Sure I can do this by multiple If strSerial.Contains("A") Then ..... End If but I think it can be done smarter.
Wish:
Select Case txtSerialNumber.text
Case.Contains("7362")
SetMark("Samsung")
Case.Contains("AT2")
SetMark("Pioneer")
Case Else
SetMark("Unknown")
End Select
'this is not working as you can expect
Best Regards
Last edited: