Why not use the Formula Root Root?
Users questions: b^2-4*a*c)^(0.5))*2*aX2=(-b+(b^2-4*a*c))^(0.5)*2*aEndIfEndSubPrivateSubCommand1_Click()Print x1= ,X1 Print "x2 =", X2EndSubPrivateSubCommand2_Click () Form1.ClsEndSub I thought that as long as three TEXT text box enter the value of ABC to the root of the equation can be found, but only Display X = Why?
Experts answer: You must be operational only after a value of abc, X1 and X2 of the expression is wrong, the code read as follows: OptionExplicitDimaAsIntegerDimbAsIntegerDimcAsInte gerDimX1AsSingleDimX2AsSinglePrivateSubCommand1_Click() a*X^2+b*x+C=0a=Val(Text1)b=Val(Text2)c=Val(T Print x1= ;X1Print x2= ;X2EndSubPrivateSubCommand2_Click()Form1.ClsEndSubPrivateSubForm_Load()Text1= Val (Text3) Ifb ^ 2-4 * a * c 0ThenMsgBox "equation has no solution!" Else: X1 = (-b + (b ^ 2-4 * a * c) ^ 0.5) * (2 * a) X2 = ( -b-(b ^ 2-4 * a * c) ^ 0.5) * (2 * A) EndIfPrint "x1 ="; X1Print "x2 ="; X2EndSub