计算工资总额时报错
程序代码:
Private Sub Command1_Click() Dim gerensds As Single ' 个人所得税 Dim fd As Single Dim renshu As Integer '人数 gerensds = Text1.Text If gerensds <= 45 Then '所得税小于45元时的处理 Text4.Text = 0.03 Text2.Text = 1 Text3.Text = gerensds / 0.03 End If If gerensds > 45 Then MsgBox ("请输入人数,如果不输入人数,则默认人数为10人") Text2.Text = 10 Text4.Text = 0.1 renshu = Text2.Text Text3.Text = Round((((gerensds / renshu + 105) / 0.1 + 3500) * renshu) - (renshu * 3500), 2) End If End Sub我用的是VB6.0,我做的一个已知个人所得税然后计算应纳税所得额的公式。我在输入个人所得税金额,然后点击运算以后,报错
“溢出,实时错误",代码如下, 我不知道我错那了,请高手指点,先谢了。
Private Sub Command1_Click()
Dim gerensds As Single ' 个人所得税
Dim fd As Single
Dim renshu As Integer '人数
gerensds = Text1.Text
If gerensds <= 45 Then '所得税小于45元时的处理
Text4.Text = 0.03
Text2.Text = 1
Text3.Text = gerensds / 0.03
End If
If gerensds > 45 Then
MsgBox ("请输入人数,如果不输入人数,则默认人数为10人")
Text2.Text = 10
Text4.Text = 0.1
renshu = Text2.Text
Text3.Text = Round((((gerensds / renshu + 105) / 0.1 + 3500) * renshu) - (renshu * 3500), 2)
End If
End Sub