vb语言用来进行选择和循环结构控制的语句有哪些
发布网友
发布时间:2023-09-08 09:11
我来回答
共2个回答
热心网友
时间:2024-11-24 12:11
选择控制语句有
1)Select Case……End Select 语句
n = al(Text1.Text)
Select Case n
Case 1
Msgbox "1"
Case 2
Msgbox "2"
Case else
Msgbox "其他值"
End Select
2)If ……Else……End If
循环控制语句有
1)For……To……Next 语句
Dim i As Integer
Dim sum As Integer
sum = 0
For i = 1 To 100
sum = sum + i
Next
2)Do……Loop语句
Dim i
i = 1
Do While i < 10
Debug.Print i
i = i + 1
Loop
3)While……Wend语句
Dim i
i = 0
While i < 5
Debug.Print i
i = i + 1
Wend
热心网友
时间:2024-11-24 12:11
if, for , while
slect case