miércoles, 12 de noviembre de 2008

SOLUCIONES DE LA ECUACION


Dim b As Double
Dim c As Double
Dim h1 As Double
Dim x2 As Double
Dim a As Double
Dim res As Double


Private Sub Command1_Click()
If a < a =" a" b =" b" c =" c"> 0 Then
x1 = (-b + Sqr(b * b - 4 * a * c)) / (2 * a)
x2 = (-b - Sqr(b * b - 4 * a * c)) / (2 * a)

Text4.Text = x1
Text5.Text = x2
Else
MsgBox ("Los valores no son validos")

End If
ElseIf b * b - 4 * a * c > 0 Then
x1 = (-b + Sqr(b * b - 4 * a * c)) / (2 * a)
x2 = (-b - Sqr(b * b - 4 * a * c)) / (2 * a)

Text4.Text = x1
Text5.Text = x2
Else
MsgBox ("Escriba bien los valores")
End If

End Sub

Private Sub Command2_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text1.SetFocus
a = 0
b = 0
c = 0

End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Text1_Change()
If Text1.Text <> " " Then
a = Val(Text1.Text)
End If
End Sub

Private Sub Text2_Change()
If Text2.Text <> " " Then
b = Val(Text2.Text)
End If
End Sub

Private Sub Text3_Change()
If Text3.Text <> " " Then
c = Val(Text3.Text)
End If
End Sub