VB错误提示 必选参数 怎么解决

来源:百度知道 编辑:UC知道 时间:2024/05/17 05:17:49
Private Sub Command1_Click()
Dim str1 As String, str2 As String, score
str1 = "成绩输入": str2 = "请输入一个百分制的成绩"
Form1.Cls
lab1: score = InputBox(str2, str1)
If IsNumeric(score) Then
score = Val(score)
If score >= 0 And score <= 100 Then
Select Case score \ 10
Case 0 To 5: grade = "E"
Case 6: grade = "D"
Case 7: grade = "C"
Case 8: grade = "B"
Case 9: grade = "A"
End Select
Else
MsgBox "输入的成绩不和法,请重新输入(0~100)!", vbInformation, "错误提示"
End If
Else
MsgBox "输入的不是合法的数值!?请重新输入!", vbInformation, "错误提示"
GoTo lab1
Form1.ForeColor = RGB(231, 15.153)
Form1.FontSize 18
Form1.Print "你输入的成绩" & score&; "等"
End Sub

Private Sub Command2_Click()
End

你的程序代码错误太多,我给你修改了一下.你看看吧

Private Sub Command1_Click()
Dim str1 As String, str2 As String, score
str1 = "成绩输入": str2 = "请输入一个百分制的成绩"
Form1.Cls
lab1:
score = InputBox(str2, str1)
If IsNumeric(score) Then
score = Val(score)
If score >= 0 And score <= 100 Then
Select Case Int(score / 10)
Case 0 To 5: grade = "E"
Case 6: grade = "D"
Case 7: grade = "C"
Case 8: grade = "B"
Case 9: grade = "A"
End Select
Else
MsgBox "输入的成绩不和法,请重新输入(0~100)!", vbInformation, "错误提示"
End If
Else
MsgBox "输入的不是合法的数值!?请重新输入!", vbInformation, "错误提示"
GoTo lab1
End If
Form1.ForeColor = RGB(231, 15, 153)
Form1.FontSize = 18
Form1.Print "你输入的成绩" & grade & "等"