问一个,很小的问题
我前几天刚学VB还没入门呢``
那个学了个小程序。用来求1元2次方程解
那个没有输入,a,b,c的值时,,会说,数据溢出,要怎么修正哪?
Private Sub Command1_Click()
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
d = b ^ 2 - 4 * a * c
X1 = Label1
X2 = Label2
If d >= 0 Then
X1 = (-b + Sqr(d)) / (2 * a)
X2 = (-b - Sqr(d)) / (2 * a)
Else
X1 = "无解"
X2 = "无解"
End If
Print
Label1 = X1
Label2 = X2
End Sub