CopyPublic Function Switch (_
ByVal ParamArray VarExpr () As Object _
) As Object
Instance
Function matchLanguage (ByVal cityName As String) As String
Return CStr (Microsoft. VisualBasic. Switch (_
CityName = "London", "English ",_
CityName = "Rome", "Italian ",_
CityName = "Paris", "French "))
End Function
Let's look at a simple example.
Module Module1
Sub Main ()
Dim intValue As Integer =-10
Console. WriteLine ("Absolute value :"&_
Microsoft. VisualBasic. Switch (intValue <0,-1 * intValue, intValue> = 0, intValue ))
End Sub
End Module
If the condensation switch case syntax is as follows:
Case requires a range of values or values. The expression after your current Case is True or False.
Either use If all or modify as follows
VB. NET code
Select case myrow1.Cells ("points"). Value
Case 0
...
Case 60 to 79
...
Case 80 to 99
...
Case is> 100
...
Case else
...
End select