VB编程:IF语句判断成绩优良
源代码:
Private Sub Command1_Click()
Dim i As Integer
i = Val(Text1)
If i = 100 Then
MsgBox "满分"
ElseIf i >= 85 Then
MsgBox "优秀"
ElseIf i >= 75 Then
MsgBox "良好"
ElseIf i >= 60 Then
MsgBox "及格"
Else
MsgBox "不及格,该努力了"
End If
End Sub
小技巧:
可将Form窗体StartUpPosition属性设置为“2-屏幕中心”,窗体运行时就会居中显示。