我的VB6出错
下面步骤哪错了?请教高手.PrivateSubCommand1_Click()DimpbsAsSinglepbs=b*b-4*a*cIfpbs>0Thenpbs=Sqr(...
下面步骤哪错了?请教高手.
Private Sub Command1_Click()
Dim pbs As Single
pbs = b * b - 4 * a * c
If pbs > 0 Then
pbs = Sqr(pbs)
Text4 = Format((-b + pbs) / 2 / a, "0.00")
Text5 = Format((-b - pbs) / 2 / a, "0.00")
ElseIf pbs = 0 Then
Text4 = Format(-b / 2 / a, "0.00")
Text5 = Format(-b / 2 / a, "0.00")
Else
pbs = Sqr(-pbs)
Text4 = Format((-b + pbs) / 2 / a, "0.00") + "+i"
Text5 = Format((-b + pbs) / 2 / a, "0.00") + "-i"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text1.SetFocus
End Sub
Private Sub Text1_LostFocus()
If Text1 <> "" And Not IsNumeric(Text1) Then
Text1 = ""
Text1.SetFocus
Else
a = Text1
End If
End Sub
Private Sub Text2_LostFocus()
If Text2 <> "" And Not IsNumeric(Text2) Then
Text2 = ""
Text2.SetFocus
Else
b = Text2
End If
End Sub
Private Sub Text3_LostFocus()
If Text3 <> "" And Not IsNumeric(Text3) Then
Text3 = ""
Text3.SetFocus
Else
c = Text3
End If
End Sub
在哪补充呢? 展开
Private Sub Command1_Click()
Dim pbs As Single
pbs = b * b - 4 * a * c
If pbs > 0 Then
pbs = Sqr(pbs)
Text4 = Format((-b + pbs) / 2 / a, "0.00")
Text5 = Format((-b - pbs) / 2 / a, "0.00")
ElseIf pbs = 0 Then
Text4 = Format(-b / 2 / a, "0.00")
Text5 = Format(-b / 2 / a, "0.00")
Else
pbs = Sqr(-pbs)
Text4 = Format((-b + pbs) / 2 / a, "0.00") + "+i"
Text5 = Format((-b + pbs) / 2 / a, "0.00") + "-i"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text1.SetFocus
End Sub
Private Sub Text1_LostFocus()
If Text1 <> "" And Not IsNumeric(Text1) Then
Text1 = ""
Text1.SetFocus
Else
a = Text1
End If
End Sub
Private Sub Text2_LostFocus()
If Text2 <> "" And Not IsNumeric(Text2) Then
Text2 = ""
Text2.SetFocus
Else
b = Text2
End If
End Sub
Private Sub Text3_LostFocus()
If Text3 <> "" And Not IsNumeric(Text3) Then
Text3 = ""
Text3.SetFocus
Else
c = Text3
End If
End Sub
在哪补充呢? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询