Public Class Form1
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim x1 As Single
Dim x2 As Single
Dim dis As Single
Dim alerta As String
Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesLabel6.Click
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton3.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton1.Click
a = TextBox1.Text
b = TextBox2.Text
c = TextBox3.Text
dis = (b ^ 2) - (4 * a * c)
If dis < 0 Then MsgBox("La ecuacion no tiene una solucion real", MsgBoxStyle.OkOnly, "Ecuaciondel tipo: Ax2+Bx+C=0")
If alerta = 1 Then
alerta = 0
dis = 0
End
End If
x1 = (-b + (Math.Sqrt(dis))) / (2 * a)
x2 = (-b - (Math.Sqrt(dis))) / (2 * a)
TextBox4.Text = x1
TextBox5.Text = x2
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesButton2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
No hay comentarios.:
Publicar un comentario