VB.net – Select Case

How to create a Switch (Select Case) in VB.Net:

Select Case value
    Case 1
        Console.WriteLine("One")
    Case 2
        Console.WriteLine("Two")
    Case 3, 4
        Console.WriteLine("Three or four")
    Case 5 To 10
        Console.WriteLine("From five to Ten")
    Case Else
        Console.WriteLine("Everything else")
End Select

Leave a Comment

Your email address will not be published. Required fields are marked *