VB.NET Switch Statement GoTo Case

前端 未结 9 1000
你的背包
你的背包 2020-12-10 23:42

I am writing some code in VB.NET that uses a switch statement but in one of the cases it needs to jump to another block. In C# it would look like this:

switc         


        
9条回答
  •  轮回少年
    2020-12-11 00:22

    you should declare label first use this :

        Select Case parameter 
            Case "userID"
                        ' does something here.
                Case "packageID"
                        ' does something here.
                Case "mvrType" 
                        If otherFactor Then 
                                ' does something here. 
                        Else 
                                GoTo else
                        End If 
    
                Case Else 
    else :
                        ' does some processing... 
                        Exit Select 
        End Select
    

提交回复
热议问题