永发信息网

编译错误 块if 没有 end if

答案:2  悬赏:40  手机版
解决时间 2021-02-26 20:54
  • 提问者网友:欲劫无渡
  • 2021-02-26 03:48
Private Sub Form_Click()
a = InputBox("Please fill in your grade")
If a >= 90 Then
MsgBox ("Excelent")
If a >= 80 Then
MsgBox ("good job")
If a >= 60 Then
MsgBox ("just so so")
If a < 60 Then
MsgBox ("you should work harder")
End If
End Sub

问:哪里错误了,求大神指正。
最佳答案
  • 五星知识达人网友:一把行者刀
  • 2021-02-26 04:03
Private Sub Form_Click()
a = InputBox("Please fill in your grade")
If a >= 90 Then

MsgBox ("Excelent")
end if
If a >= 80 Then
MsgBox ("good job")
end if
If a >= 60 Then
MsgBox ("just so so")
end if
If a < 60 Then
MsgBox ("you should work harder")
End If
End Sub
每一个if后面都要有end if做结尾
除非从第二个if开始用的elseif 就可以最后只用一个end if
全部回答
  • 1楼网友:话散在刀尖上
  • 2021-02-26 05:36
dim a as single, b as single, c as single a = val(text1.text) b = val(text2.text) if combo1.text = "+" then c = a + b if combo1.text = "-" then c = a - b if combo1.text = "*" then c = a * b if combo1.text = "/" then c = a / b text3.text = cstr(c) 或是按照你的思路来呵: dim a as single, b as single, c as single a = val(text1.text) b = val(text2.text) if combo1.text = "+" then c = a + b elseif combo1.text = "-" then c = a - b elseif combo1.text = "*" then c = a * b else c = a / b end if text3.text = cstr(c)
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯