请帮我把这个VB算法改正确

来源:百度知道 编辑:UC知道 时间:2024/07/03 03:48:09
Private Sub Command1_Click()
Dim Cj As Single '定义变量Cj,值由文本框Txet1读入
Cj = Val(Text1.Text)
If Cj < 60 Then
Lable1.Caption = "不及格"
End If
If Cj >= 85 Then
Lable1.Caption = "优秀"
End If
If Cj >= 60 And Cj < 85 Then
Lable1.Caption = "良好"
End If
End Sub

Private Sub Command1_Click()
Dim Cj As Single '定义变量Cj,值由文本框Txet1读入
Cj = Val(Text1.Text)
If Cj < 60 Then
Label1.Caption = "不及格"
ElseIf Cj >= 60 And Cj < 85 Then
Label1.Caption = "良好"
Else ' Cj >= 85
Label1.Caption = "优秀"
End If
End Sub
你那个Label 写错了,还有那个Elseif 不用空格的

Private Sub Command1_Click()
on error resume next
Dim Cj As Single '定义变量Cj,值由文本框Txet1读入
Cj = Val(Text1.Text)
if Err.number<>0 Then
msgbox "输入错误,无法转换为数值"
exit sub
End If

If Cj < 60 Then Lable1.Caption = "不及格"

If Cj >= 85 Then Lable1.Caption = "优秀"

If Cj >= 60 And Cj < 85 Then Lable1.Caption = "良好"

End Sub

Private Sub Command1_Click()
Dim Cj As Single '定义变量Cj,值由文本框Txet1读入
Cj = Val(Text1.Text)
if Cj>=85 then
Label1.Caption="优秀&qu