最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
vb.net switch 语句的使用方法
时间:2022-06-25 05:33:57 编辑:袖梨 来源:一聚教程网
CopyPublic Function Switch( _
ByVal ParamArray VarExpr() As Object _
) As Object
实例
Function matchLanguage(ByVal cityName As String) As String
Return CStr(Microsoft.VisualBasic.Switch( _
cityName = "London", "English", _
cityName = "Rome", "Italian", _
cityName = "Paris", "French"))
End Function
再看一个简单的实例
Module Module1
Sub Main()
Dim intValue As Integer = -10
Console.WriteLine("Absolute value: " & _
Microsoft.VisualBasic.Switch(intValue = 0, intValue))
End Sub
End Module
如果缩合switch case语法如下
Case后面需要的是值或值的范围。你现在Case后面的表达式求得的是True或False。
要么全用If,要么如下修改
VB.NET code
select case myrow1.Cells("积分").Value
case 0
...
case 60 to 79
...
case 80 to 99
...
case is > 100
...
case else
...
end select
相关文章
- Ruby的面向对象方式编程学习杂记 09-23
- 解析proxy代理模式在Ruby设计模式开发中的运用 09-23
- 深入剖析Ruby设计模式编程中对命令模式的相关使用 09-23
- 详解组合模式的结构及其在Ruby设计模式编程中的运用 09-23
- 设计模式中的模板方法模式在Ruby中的应用实例两则 09-23
- 借助RubyGnome2库进行GTK下的Ruby GUI编程的基本方法 09-23