I realize I’m not on a VB site, but I’m a long time Kirupa member and you guys are the best at helping out.
Anyway, it’s been a long time since I opened VB and I just needed to make a real simple program. Someone enters their income, then based on their salary, their taxes are displayed.
One input TextBox, one ouput TextBox, and a button to calculate.
I’m almost there, I’m just missing something, I forget the syntax…
I have a TextBox for income:
txt_income
I have a TextBox for income + taxes:
txt_taxtotal
And a Calculate button:
btn_calculate
Here is the code: (I didn’t want to use a class like you did)
Dim FinalTax As Single
Private Sub btn_calculate_Click()
Dim objCustomer As cCustomer
Set objCustomer = New cCustomer
objCustomer.income = CSng(txt_income.Text)
If income > 0 And income <= 27050 Then
FinalTax = income * 0.15
Else
If income > 27050 And income <= 65550 Then
FinalTax = ((income + 4057.5) * 0.28)
Else
If income > 65550 And income <= 136750 Then
FinalTax = ((income + 14645) * 0.31)
Else
If income > 136750 And income <= 297350 Then
FinalTax = ((income + 36361) * 0.36)
Else
If income > 297350 Then
FinalTax = ((income + 93374) * 0.39)
End If
End If
End If
End If
End If
txt_taxtotal.Caption = Format(objCustomer.FinalTax, "Currency")
End Sub
I’m getting a lot of errors, maybe tell me what I’m missing?
Here is the file(s)
http://www.basicfunction.com/tax_calc/tax.zip
Thanks
Mickey