'在Text1中输入学生的成绩,点击“转换”按钮后,转换成相应的等级并显示在Label1中!
Private Sub Command1_Click()
Dim exam As Integer '定义变量exam用来存放成绩
'判断输入的成绩是否为数值!
If IsNumeric(Text1.Text) = False Then
If MsgBox(\您输入的成绩必须为数字!\ Exit Sub End If End If
'判断输入的成绩是否合法 exam = Val(Text1.Text)
If exam < 0 Or exam > 100 Or Len(exam) = 0 Then
If MsgBox(\您输入的成绩不正确!\ Exit Sub End If End If
'将输入的成绩转换为相应的等级 Select Case __①__ Case __②__
Label1.Caption = \该学生的成绩等级为:D\
11
Case __③__
Label1.Caption = \该学生的成绩等级为:C\ Case __④__
Label1.Caption = \该学生的成绩等级为:B\ Case __⑤__
Label1.Caption = \该学生的成绩等级为:A\ __⑥__ End Sub 20、
'(1)删除①②③及下划线,填空完成程序。
'(2)点击“计算”按钮后,在窗体上输出“1+2+??+100”的和,并求出1到100之间能被19整除的整数的个数
'注:请不要更改原程序结构,删除①、②、③及下划线,并在对应位置填写正确的代码。
Private Sub Command1_Click() Dim i As Integer, x As Integer Dim s As Integer s = 0 x = 0
For i = 1 To 100
______①______
If _____②____ Then x = _____③_____ Next i
Print \
Print \到100之间能被19整除有:\个数\
End Sub
12