You are on page 1of 1

Public Class Form1

Dim a, b, c, d, x1, x2, Real, imag As Single


Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles
MyBase.Load

End Sub

Private Sub Button3_Click(sender As System.Object, e As System.EventArgs)
Handles Button3.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
End Sub

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs)
Handles Button1.Click
a = Val(TextBox6.Text)
b = Val(TextBox7.Text)
c = Val(TextBox8.Text)
d = b ^ 2 - 4 * a * c
If d >= 0 Then
x1 = (-b + Math.Sqrt(d)) / (2 * a)
x2 = (-b - Math.Sqrt(d)) / (2 * a)
TextBox4.Text = x1
TextBox1.Text = x2
End If
If d < 0 Then
Real = -b / (2 * a)
imag = Math.Sqrt(-d) / (2 * a)
TextBox4.Text = Real
TextBox1.Text = Real
TextBox3.Text = imag
TextBox2.Text = imag


End If

End Sub

Private Sub TextBox7_TextChanged(sender As System.Object, e As System.EventArgs)
Handles TextBox7.TextChanged

End Sub

Private Sub Button2_Click(sender As System.Object, e As System.EventArgs)
Handles Button2.Click
End
End Sub
End Class

You might also like