byref 参数类型不符.请指点
VB程序总是提示说byref 参数类型不符。什么原因啊,谢谢指点。Public Function sqrt(a As Single) As Double
sqrt = Sqr(a)
End Function
Private Sub Command1_Click()
Dim a As Integer, b As Integer, c As Integer, D As Integer
Dim X As Single, X1 As Single, X2 As Single
a = Val(InputBox("请输入a的值!"))
b = Val(InputBox("请输入b的值!"))
c = Val(InputBox("请输入c的值!"))
D = b * b - 4 * a * c
If D < 0 Then
Print "此方程无解!"
Else
If D = 0 Then
X = -b / (2 * a)
Print "此方程有相等的实数解,解为" & Str(X)
Else
X1 = (-b + sqrt(D)) / (2 * a)
X2 = (-b - sqrt(D)) / (2 * a)
Print "此方程有不同的实数解,解为" & "X1=" & X1&; "X2=" & X2
End Sub