vb安装问题_vb 的问题
Option Explicit
Private Sub Command1_Click()
If Text1.Text = "" Then MsgBox "不能不输入成绩。"
If Text1.Text = "" Then GoTo i:
Select Case Text1.Text
Case Text1.Text = " 100"
MsgBox "完美!"
Case Text1.Text = "99"
MsgBox "Good."
Case Text1.Text = "90 To 98"
MsgBox "差一点,加油!"
Case Text1.Text = " 70 To 89"
MsgBox "还行,加油。"
Case Text1.Text = " 69 To 60"
MsgBox "差一点不及格,加油。"
Case Else
MsgBox "不及格,太差了。"
i: Exit Sub
End Select
End Sub
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Command3_Click()
Form2.Show
Form1.Hide
End Sub
Private Sub Form_Load()
Text1.Text = ""
End Sub
为什么总是出现弹出提示框“不及格,太差了”?
最佳答案
Private Sub Command1_Click()
Dim n
n = Val(Text1.Text)
If n < 0 Or n > 100 Then
MsgBox "输入的成绩无效。"
Exit Sub
End If
Select Case n
Case 100
MsgBox "完美!"
Case 99
MsgBox "Good"
Case 90 To 98
MsgBox "差一点,加油!"
Case 70 To 89
MsgBox "还行,加油。"
Case 60 To 69
MsgBox "差一点不及格,加油。"
Case Else
MsgBox "不及格,太差了。"
End Select
End Sub
其他回答
其它网友回答:
在常量字符串前加 L 就可以了。