假定输入成绩的文本框是Text1,输出结果的文本框是Text2,查询按钮是Command1。学分由于没有给出计算方法,这里就不考虑了。
Private Sub Command1_Click()
Dim cj As Integer, dj As String
cj = Val(Text1.Text)
If CStr(cj) <> Text1.Text Then
dj = "不存在"
Else
Select Case cj
Case 85 To 100
dj = "优秀"
Case 75 To 84
dj = "良好"
Case 60 To 74
dj = "及格"
Case 0 To 59
dj = "不及格"
Case Else
dj = "不存在"
End Select
End If
Text2.Text = dj
End Sub