IF數組
If intNumber = 1000 Then
MessageBox.Show("'intNumber' is, indeed, 1000!", "Simple If")
ElseIf intNumber = 27 Then
MessageBox.Show("'intNumber' is 27!", "Simple If")
Else
MessageBox.Show("'intNumber' is not 1000!", "Simple If")
End If
單行的if語句 不須要End If 單行的If語句若是須要執行多個操做, 須要用冒號隔開.
不等於的符號 <> 也能夠用 If Not strName = "Wendy" Thenoop
-------------------------------------------------------------------------------------------------------------------------------排序
邏輯操做符寫法 And Or
不區分大小寫 ToLower toUpperit
-------------------------------------------------------------------------------------------------------------------------------io
Select Case
Select Case strName.ToLower
Case "eddie","ccc","bbb",
strFavoriteColor = "Passionate Purple"
Case "katelyn"
strFavoriteColor = "Red"
Case Else
'do something here
End Selectast
For...NextList
-------------------------------------------------------------------------------------------------------------------------------循環
循環方法
循環 能夠指定步長 步長能夠爲負數--從大到小循環
Do Untile 條件 ' 直到所給的條件知足爲止
語句....
Loop
與之相對的是 Do While Loop語句
Until 和 While能夠放到Loop以後 這樣循環至少執行一次
與Do While Loop 對應的老的形式的循環是 While End While
退出循環 用 Exit For 和 Exit Do來退出循環im
退出當前循環,執行下一次 Continue For 和 Continue Do
-------------------------------------------------------------------------------------------------------------------------------
定義數組
Dim strArr(9) As String ' 注意,這兒的9 是 last index,也就是說,數組的長度是10
Array.Sort(strArr) ' 可使用這個方法對數組排序
Reverse方法能夠對數組反向
也可使用下面的方法定義數組並賦值
Dim strArr2 As String = {"a","b","c"}
-------------------------------------------------------------------------------------------------------------------------------
枚舉類型定義 enum
常量 const
結構定義 用 structure
list 用 ArrayList
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------