不输入信息提示错误,无法实现
本帖最后由 hdstu 于 2009-8-15 10:42 编辑下面的代码,如果什么也不输入则提示不及格,加段什么语句可以实现,不输入数据提示录入错误,谢谢!
Dim $s
$s=InputBox("学生成绩","请输入学生的成绩","","","-1","-1","190","115","60")
If @error=1 Or $s="" Then
EndIf
Switch $s
Case 91 To 100
MsgBox(0,"学生成绩","优秀!")
Case 81 To 90
MsgBox(0,"学生成绩","良好!")
Case 60 To 80
MsgBox(0,"学生成绩","及格!")
Case 0 To 59
MsgBox(0,"学生成绩","他妈的笨蛋不及格!")
Case Else
MsgBox(0+16,"学生成绩","学生成绩输入错误!")
EndSwitch 按LZ的用词习惯修改了下:While 1
$s = InputBox("学生成绩", "请输入学生的成绩", "", " m3", "250", "120")
If @error = 1 Then Exit (MsgBox(0, 'Fuck', '不玩了?白白!', 1))
If $s <> '' Then
If StringIsDigit($s) = 0 Then
MsgBox(0, 'Fuck', '请TMD输入数字!')
ElseIf $s > 100 Then
MsgBox(0, 'Fuck', '这可是TMD百分制,别TMD超过100!')
Else
ExitLoop
EndIf
EndIf
WEnd
Switch $s
Case 91 To 100
MsgBox(0, "学生成绩", "优秀!")
Case 81 To 90
MsgBox(0, "学生成绩", "良好!")
Case 60 To 80
MsgBox(0, "学生成绩", "及格!")
Case 0 To 59
MsgBox(0, "学生成绩", "他妈的笨蛋不及格!")
EndSwitch While 1
$s = InputBox("学生成绩", "请输入学生的成绩", "", " m3", "250", "120")
If @error = 1 Then Exit (MsgBox(0, 'Fuck', '不玩了?白白!', 1))
If $s <> '' Then
If StringIsDigit($s) = 0 Then
MsgBox(0, 'Fuck', '请TMD输入数字!')
ElseIf $s > 100 Then
MsgBox(0, 'Fuck', '这可是TMD百分制,别TMD超过100!')
ElseIf $s < 0 Then
MsgBox(0, 'Fuck', 'kao!别上了,回家生孩子吧!')
Else
ExitLoop
EndIf
EndIf
WEnd 谢谢大家。。
页:
[1]