[求助]赋值号左边的函数调用必须返回变体或对象
我做了个ax^2+bx+c=0的vb程序
可是在调试时出现“赋值号左边的函数调用必须返回变体或对象”的错误
请高手斧正一下
代码在下
小弟万分感激
Private Sub Command1_Click()
If b ^ 2 - 4 * a * c < 0 Then
MsgBox = "此方程无实根"
ElseIf b ^ 2 - 4 * a * c >= 0 Then
Text4.Text = x1: Text5.Text = x2
x1 = (-b + Sqr(b ^ 2 - 4 * a * c)) / (2 * a)
x2 = (-b - Sqr(b ^ 2 - 4 * a * c)) / (2 * a)
ElseIf a = 0 And b = 0 Then
MsgBox = "此方程无意义"
ElseIf a = 0 And b <> 0 Then
x1 = x2 = -c / b
End If
End Sub
Private Sub Form_Load()
Dim a As Single
Dim b As Single
Dim c As Single
Dim x1 As Single
Dim x2 As Single
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
x1 = Val(Text4.Text)
x2 = Val(Text5.Text)
End Sub