VB提示“缺少:语句结束”
PrivateSubCommand1_Click()DimscooreAsInteger,tempAsStringscoore=Val(Text1.Text)temp="...
Private Sub Command1_Click()
Dim scoore As Integer, temp As String
scoore = Val(Text1.Text)
temp = "成绩等级为:"
Select Case scoore
Case 0 To 59
label 2 caption = temp + "不及格" (从这开始说缺少语句结束的)
Case 50 To 69
label 2 caption = temp + "及格"
Case 80 To 100
label 2 caption = temp + "优良"
Case Else
label 2 caption = "成绩出错!"
End Select
End Sub 展开
Dim scoore As Integer, temp As String
scoore = Val(Text1.Text)
temp = "成绩等级为:"
Select Case scoore
Case 0 To 59
label 2 caption = temp + "不及格" (从这开始说缺少语句结束的)
Case 50 To 69
label 2 caption = temp + "及格"
Case 80 To 100
label 2 caption = temp + "优良"
Case Else
label 2 caption = "成绩出错!"
End Select
End Sub 展开
4个回答
展开全部
正确语句如下:
Private Sub Command1_Click()
Dim scoore As Integer, temp As String
scoore = Val(Text1.Text)
temp = "成绩等级为:"
Select Case scoore
Case 0 To 59
Label2.Caption = temp + "不及格"
Case 50 To 69
Label2.Caption = temp + "及格"
Case 80 To 100
Label2.Caption = temp + "优良"
Case Else
Label2.Caption = "成绩出错!"
End Select
End Sub
楼上的别管成绩冲突不冲突,就是冲突语只是执行的结果正确与否问题,不会影响语法的。
Private Sub Command1_Click()
Dim scoore As Integer, temp As String
scoore = Val(Text1.Text)
temp = "成绩等级为:"
Select Case scoore
Case 0 To 59
Label2.Caption = temp + "不及格"
Case 50 To 69
Label2.Caption = temp + "及格"
Case 80 To 100
Label2.Caption = temp + "优良"
Case Else
Label2.Caption = "成绩出错!"
End Select
End Sub
楼上的别管成绩冲突不冲突,就是冲突语只是执行的结果正确与否问题,不会影响语法的。
追问
我运行了,为什么还是说错误
追答
我是在VB6编程环境下把你的语句粘过去的,错的地方改了一下,没问题了,窗口得加一个标签Label2,用来显示成绩状态,一个文本框Text1,用来输成绩,一个Command1按钮,用来执行语句。这样就不缺少对象了。
展开全部
改正后代码
Private Sub Command1_Click()
Dim score As Integer, temp As String
score = Val(Text1.Text)
temp = "成绩等级为:"
Select Case scoore
Case 0 To 59
Label2.Caption = temp + "不及格"
Case 60 To 79
Label2.Caption = temp + "及格"
Case 80 To 100
Label2.Caption = temp + "优良"
Case Else
Label2.Caption = "成绩出错!"
End Select
End Sub
1.主要是label 2 caption--------Label2.Caption
2.还有这里面
Case 50 To 69
label 2 caption = temp + "及格"
改成
Case 60 To 79
Label2.Caption = temp + "及格"
3.还有分数的英文是score
Private Sub Command1_Click()
Dim score As Integer, temp As String
score = Val(Text1.Text)
temp = "成绩等级为:"
Select Case scoore
Case 0 To 59
Label2.Caption = temp + "不及格"
Case 60 To 79
Label2.Caption = temp + "及格"
Case 80 To 100
Label2.Caption = temp + "优良"
Case Else
Label2.Caption = "成绩出错!"
End Select
End Sub
1.主要是label 2 caption--------Label2.Caption
2.还有这里面
Case 50 To 69
label 2 caption = temp + "及格"
改成
Case 60 To 79
Label2.Caption = temp + "及格"
3.还有分数的英文是score
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
应该是 label2.caption 吧,你写成了 label 2 caption
其他的都类似
其他的都类似
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
“label 2” 是干什么的?
另外,0 to 59 和50 to 69有冲突啊,这种Case语句应该不允许冲突才对。
另外,0 to 59 和50 to 69有冲突啊,这种Case语句应该不允许冲突才对。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询