请教VB高手,这个程序在运行时提示实时错误6溢出怎么回事

[复制链接]
查看11 | 回复1 | 2008-11-3 07:57:13 | 显示全部楼层 |阅读模式
求一元二次方程的根,运行时提示实时错误6溢出,请高手指教,非常感谢了,在线等……
Private Sub Command1_Click()
Dim pbs As Double
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_Change()
If Text1"" And Not IsNumeric(Text1) Then

Text1 = ""

Text1.SetFocus
Else

a = Text1
End If
End Sub
Private Sub Text2_Change()
If Text2"" And Not IsNumeric(Text2) Then

Text2 = ""

Text2.SetFocus
Else

b = Text2
End If
End Sub
Private Sub Text3_Change()
If Text3"" And Not IsNumeric(Text3) Then

Text3 = ""

Text3.SetFocus
Else

c = Text3
End If
End Sub

回复

使用道具 举报

千问 | 2008-11-3 07:57:13 | 显示全部楼层
If Text1"" And Not IsNumeric(Text1) Then等相似语句错改If Text1"" or Not IsNumeric(Text1) Then但If Text1" " 时a=0运行时提示实时错误6溢出....
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行