Public Class Private Sub As Object As Handles Dim As String As String Dim As String As String Dim As String As String

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Public Class Form1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Dim a As String, b As String
Dim c As String, d As String
Dim R1 As String, R2 As String
a = Val(TextBox1.Text)
b = Val(TextBox2.Text)
c = Val(TextBox3.Text)
d = (b ^ 2) - (4 * a * c)
If d > 0 Then
End If
R1 = (-b + Math.Sqrt(d)) / (2 * a)
R2 = (-b - Math.Sqrt(d)) / (2 * a)
TextBox4.Text = R1
TextBox5.Text = R2
If d = 0 Then
R1 = -(b / (2 * a))
TextBox4.Text = R1
End If
If d < 0 Then
R1 = (-(b / (2 * a)) + ((Math.Sqrt(d * -1)) / (2 * a))) & "i"
R2 = (-(b / (2 * a)) - ((Math.Sqrt(d * -1)) / (2 * a))) & "i"
TextBox4.Text = R1
TextBox5.Text = R2
MsgBox("Las races son complejas")
End If
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


End
End Sub
End Class

You might also like