今天,我们共同来学习用VB编程开发的实际应用软件--个人所得税快速计算程序。
个人所得税是调整征税机关与自然人之间在个人所得税的征纳与管理过程中所发生的社会关系的法律规范的总称。
目前最新的起征点为每月5000元。
个人所得税税率表
由上面的表格数据,接下来我们利用VB编程来实现本功能。
首先,根据税率对应的数据,我们可以知道不同的数值范围对应的计算税率不同,于是我们就应该想到用VB编程中的选择结构语句来实现本功能。

程序代码

Dim x As Double, y As Double, w As Double, s As Double, t As Double
Private Sub Command1_Click()
t = Val(Text1.Text) - Val(Text2.Text) '工资所得-五险一金
MsgBox (t)
Select Case t
Case Is <= 0
Text3.Text = 0
Text4.Text = Val(Text1.Text)
Case 0 To 3000
Text3.Text = t * 0.03
Text4.Text = Val(Text1.Text) - Val(Text3.Text)
Case 3000 To 12000
Text3.Text = t * 0.1 - 210
Text4.Text = Val(Text1.Text) - Val(Text3.Text)
Case 12000 To 25000
Text3.Text = t * 0.2 - 1410
Text4.Text = Val(Text1.Text) - Val(Text3.Text)
Case 25000 To 35000
Text3.Text = t * 0.25 - 2660
Text4.Text = Val(Text1.Text) - Val(Text3.Text)
Case 35000 To 55000
Text3.Text = t * 0.3 - 4410
Text4.Text = Val(Text1.Text) - Val(Text3.Text)
Case 55000 To 80000
Text3.Text = t * 0.35 - 7160
Text4.Text = Val(Text1.Text) - Val(Text3.Text)
Case Is > 80000
Text3.Text = t * 0.45 - 15160
Text4.Text = Val(Text1.Text) - Val(Text3.Text)
End Select
End Sub
Private Sub Command2_Click() '清除Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""End Sub
Private Sub Form_Load() '窗体载入代码Text1.Text = ""Text2.Text = ""Text3.Text = ""Text4.Text = ""End Sub
Private Sub Text1_LostFocus() '验证数据
If Not IsNumeric(Text1.Text) Then
MsgBox ("请输入数字")
Text1.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub Text2_LostFocus() '验证数据
If Not IsNumeric(Text2.Text) Then
MsgBox ("请输入数字")
Text2.Text = ""
Text2.SetFocus
End If
End Sub
实际运行图
有了这个程序,以后计算所得税就不用网上搜索或者计算器计算了,用VB直接点击后,数据结果立即出现,快快试试吧~
祝大家学习成功!
VB学习有问题,就找跟我学VB!
大家在学习过程中有学习问题,可以添加小编微信号:vbyjk521 ,小编会耐心提供在线解答。
VB全套视频讲解资料现在优惠发放中,要学好VB编程的朋友可以添加小编微信。