1、代码修改为:
Option
Explicit
Private
Sub
Command1_Click()
Dim
a
As
Long
a
=
Val(Text1.Text)
If
100
>=
a
And
a
>=
90
Then
MsgBox
"恭喜您,您的成绩为优秀!",
vbOKCancel,
"您成绩的类型为"
ElseIf
89
>=
a
And
a
>=
80
Then
MsgBox
"恭喜你,您的成绩为良好!",
vbOKCancel,
"您成绩的类型为"
ElseIf
79
>=
a
And
a
>=
70
Then
MsgBox
"您的成绩为中等!",
vbOKCancel,
"您成绩的类型为"
ElseIf
69
>=
a
And
a
>=
60
Then
MsgBox
"很糟糕,你的成绩刚好及格!",
vbOKCancel,
"您成绩的类型为"
ElseIf
60
>
a
Then
MsgBox
"必须努力了,你的成绩不及格!",
vbOKCancel,
"您成绩的类型为"
End
If
End
Sub
Private
Sub
Command2_Click()
End
End
Sub
2、msgbox
和
print
区别:
msgbox
是提示框的形式来显示的,有不同的提示类型;
print直接在当前窗体中输出;