a=val(alltrim(thisform.text1.value))
b=val(alltrim(thisform.text2.value))
c=val(alltrim(thisform.text3.value))
*若三个系数初始值为数值型的,则可以简单写成
*a=thisform.text1.value
*b=thisform.text2.value
*c=thisform.text3.value
d=b^2-4*a*c
do case
case a=0 and b=0 and c=0
thisform.label1.caption='恒等式,无数多个解'
thisform.label1.visible=.t.
thisform.label2.visible=.f.
case a=0 and b=0 and c#0
thisform.label1.caption='恒不等式,无解'
thisform.label1.visible=.t.
thisform.label2.visible=.f.
case a=0 and b#0
thisform.label1.caption='一元一次方程,唯一解x='+alltrim(str(-c/b,12,4))
thisform.label1.visible=.t.
thisform.label2.visible=.f.
case d>0
thisform.label1.caption='x1='+alltrim(str((-b+sqrt(d))/(2*a),12,4))
thisform.label2.caption='x2='+alltrim(str((-b-sqrt(d))/(2*a),12,4))
thisform.label1.visible=.t.
thisform.label2.visible=.t.
case d=0
thisform.label1.caption='x1=x2='+alltrim(str((-b+sqrt(d))/(2*a),12,4))
thisform.label1.visible=.t.
thisform.label2.visible=.f.
case d<0
thisform.label1.caption='x1='+alltrim(str(-b/(2*a),12,4))+'+'+alltrim(str(sqrt(-d)/abs(2*a),12,4))+'i'
thisform.label2.caption='x2='+alltrim(str(-b/(2*a),12,4))+'-'+alltrim(str(sqrt(-d)/abs(2*a),12,4))+'i'
thisform.label1.visible=.t.
thisform.label2.visible=.t.
endcase