第1个回答 2018-05-17
窗体上一共有三个command (1指“判定”按钮,2指“清除”按钮,3指"结束"按钮);两个文本框(1是输入成绩的,2是判别的)
Private Sub Command1_Click()
Dim a As Integer
a =Val(Text1.Text)
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
(上面的后三行代码是选中文本框1,如果不需要可以删除)
Select Case a
Case 90 To 100
Text2.Text = "优秀"
Case 75 To 89
Text2.Text = "良好"
Case 60 To 74
Text2.Text = "及格"
Case Is < 60
Text2.Text = "不及格"
End Select
If a < 0 Or a > 100 Then
MsgBox "输入错误,请重新输入"
End If
(这里的后三行是提示,如果输入负数或者大于100的数,显示输入错误,不需要可删除)
End Sub
Private Sub Command2_Click()
Text1.Cls
Text2.Cls
End Sub
Private Sub Command3_Click()
end
end sub