VB成绩排序,超急
Dimx,yAsIntegerPrivateSubText1_Change()x=Val(Text1.Text)SelectCasexCasex<0MsgBox"数据错误...
Dim x, y As Integer
Private Sub Text1_Change()
x = Val(Text1.Text)
Select Case x
Case x < 0
MsgBox "数据错误"
Case x <= 60
y = ("不及格")
Case x <= 70
y = ("及格")
Case x <= 80
y = ("中等")
Case x <= 90
y = ("良好")
Case x <= 100
y = ("优秀")
Case Else
MsgBox "成绩不可以大于100"
Text2.Text = y
End Select
End Sub
哪里错了呢 展开
Private Sub Text1_Change()
x = Val(Text1.Text)
Select Case x
Case x < 0
MsgBox "数据错误"
Case x <= 60
y = ("不及格")
Case x <= 70
y = ("及格")
Case x <= 80
y = ("中等")
Case x <= 90
y = ("良好")
Case x <= 100
y = ("优秀")
Case Else
MsgBox "成绩不可以大于100"
Text2.Text = y
End Select
End Sub
哪里错了呢 展开
2个回答
展开全部
声明不要了
Private Sub Text1_Change()
x = Val(Text1.Text)
If x < 0 Then
MsgBox "数据错误"
ElseIf x <= 60 Then
y = "不及格"
ElseIf x <= 70 Then
y = "及格"
ElseIf x <= 80 Then
y = "中等"
ElseIf x <= 90 Then
y = "良好"
ElseIf x <= 100 Then
y = "优秀"
Else
MsgBox "成绩不可以大于100"
End If
Text2.Text = y
End Sub
Private Sub Text1_Change()
x = Val(Text1.Text)
If x < 0 Then
MsgBox "数据错误"
ElseIf x <= 60 Then
y = "不及格"
ElseIf x <= 70 Then
y = "及格"
ElseIf x <= 80 Then
y = "中等"
ElseIf x <= 90 Then
y = "良好"
ElseIf x <= 100 Then
y = "优秀"
Else
MsgBox "成绩不可以大于100"
End If
Text2.Text = y
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询