I am just learning visual basic and have been trying to write a code to solve quadratic equations with complex number as roots. Any pointer in the right direction would be appreciated.
Public Class Form1
Dim a, b, c As Integer
Dim x1, x2 As Double
Private Sub Label4_Click(sender As Object, e As EventArgs) Handles Label4.Click
End Sub
Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles eqnRT1.TextChanged
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Close()
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
txtA.Text = ""
txtB.Text = ""
txtC.Text = ""
eqnRT1.Text = ""
eqnRT2.Text = ""
End Sub
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
Dim a,b,c as integer
a = txtA.Text
b = txtB.Text
c = txtC.Text
Dim x1 = (-b + math.Sqrt(b * b - 4 * a * c)) / (2 * a)
Dim x2 = (-b - math.Sqrt(b * b - 4 * a * c)) / (2 * a)
eqnRT1.Text = Str(x1)
eqnRT2.Text = Str(x2)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class