pt bac hai
Private Sub Command1_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Dim a, b, c, d As Double
Dim x1, x2 As String
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If (a = 0) Then
Text4 = (-c / b)
Text5 = ""
lbl5 = ""
Else
d = (b * b) - (4 * a * c)
If d < 0 Then
lbl5 = "PT vo nghiem"
Text4 = ""
Text5 = ""
Else
If (d = 0) Then
lbl5 = "PT co mot nghiem"
Text4 = Str(-b / (2 * a))
Text5 = " "
Else
x1 = ((-b) - Sqr(d)) / (2 * a)
x2 = ((-b) + Sqr(d)) / (2 * a)
Text4.Text = Format(x1, "0.00")
Text5.Text = Format(x2, "0.00")
lbl5 = "PT co hai nghiem"
End If
End If
End If
End Sub
Private Sub Command3_Click()
If MsgBox("Ban muon thoat ko?", vbYesNo + vbQuestion + vbDefaultButton1, "Thong bao") = vbYes Then
End
End If
End Sub
Private Sub Command4_Click()
lbl5 = " "
Text4 = " "
Text5 = " "
End Sub
Bạn đang đọc truyện trên: AzTruyen.Top