请大家帮忙看一下这段VB程序

来源:百度知道 编辑:UC知道 时间:2024/05/12 08:01:33
请大家帮忙看一下这段VB程序,我想做一个计算二次函数的程序,其中这段在运行的时候总是提示我:"Case 缺少 Select Case",可是里边明明有啊。。请大家帮忙看看改改,谢谢!

Private Sub Command2_Click()
If Option1(0).Value = True Then
a = Val(Text1(0).Text)
b = Val(Text1(1).Text)
c = Val(Text1(2).Text)
d = b ^ 2 - 4 * a * c
If Not a = 0 Then
e = (-d) / 4 * a
Else
e = 0
End If

Select Case True

Case a > 0
Label2(0).Caption = "小"
Label2(4).Caption = "(" & (-2 * a) / b & "," & e & ")"
Label2(3).Caption = c
If d > 0 Then
Label2(1).Caption = (-b - d ^ 0.5) / (2 * a)
Label2(2).Caption = (-b + d ^ 0.5) / (2 * a)
If d = 0 Then
Label2(1).Caption = (-b - d ^ 0.5) / (2 * a)
Else
Label2(1).Caption = "与x轴无交点"
End If

Case a < 0
Label2

检查其他语句有没有首尾配对好。
例如检查If是否有最后跟上一个End If

发现你漏了很多End If噢!!

你在第一条case a<0语句的上面少一个endif
在第一条case else语句上面也少了一个endif
加上这2个endif你在试试

select case a

同意楼上。