Private Sub Command1_Click()
Dim d As Single
d = b * b - 4 * a * c
If a = 0 Then
MsgBox ("PT co nghiem duy nhat ")
Text1.Text = -c / b
Else
If d < 0 Then
MsgBox (" PT vo nghiem")
ElseIf d = 0 Then
MsgBox ("PT co nghiem kep")
Text1.Text = -b / (2 * a)
Text2.Text = -b / (2 * a)
Else
MsgBox (" PT co 2 nghiem phan biet ")
Text1.Text = -b + Sqr(d) / 2 * a
Text2.Text = -b - Sqr(d) / 2 * a
End If
End If
End Sub
Private Sub Command2_Click()
a = " "
b = " "
c = " "
Text1.Text = " "
Text2.Text = " "
End Sub
Private Sub a_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
End Sub
Private Sub b_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
End Sub
Private Sub c_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
End Sub
Không có nhận xét nào:
Đăng nhận xét