Public Class Form1
Dim i1 As Single
Dim i2 As Single
Dim i3 As Single
Dim delta As Single
Dim x1 As Single
Dim x2 As Single
Private Sub Label1_Click(sender As System.Object, e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Label5_Click(sender As System.Object, e As System.EventArgs) Handles Label5.Click
End Sub
Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles T1.TextChanged
End Sub
Private Sub TextBox2_TextChanged(sender As System.Object, e As System.EventArgs) Handles T2.TextChanged
End Sub
Private Sub TextBox3_TextChanged(sender As System.Object, e As System.EventArgs) Handles T3.TextChanged
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
i1 = T1.Text
i2 = T2.Text
i3 = T3.Text
delta = (i2 * i2) - 4 * (i1 * i3)
x1 = -i2 + delta
x2 = -i2 - delta
Ld.Text = delta
L1.Text = x1
L2.Text = x2
End Sub
End Class
ill attach a photo of the ui.
the problem is that for exemple,in a simple equation like X²+6X+9 the use inputs 1 in a 6 in b and 9 in c and the result should be X=3 or X=-3 but the program says X=-6 or X=-6.
any idea why its doing the maths wrong?

New Topic/Question
Reply



MultiQuote





|