|
-
October 8th, 1999, 10:24 AM
#1
calculate
I am taking the value of a number and multiplying it by .20. Then the I am trying to take the new value and subtract t from the original number. What am I doing wrong here?
option Explicit
private Sub cmdCalculate_Click()
Dim GrossSalary as Double
Dim GrossSalaryCalc as Double
Dim TaxLoss as Double
Dim NetSalary as Double
Dim YearlySalary as Double
GrossSalary = Val(txtGrossSalary.Text)
'GrossSalaryCalc = GrossSalary - TaxLoss
TaxLoss = Val(lblTaxLoss.Caption)
'NetSalary = Val(lblNetSalary.Caption)
'YearlySalary = Val(lblYearlySalary.Caption)
lblTaxLoss.Caption = GrossSalary * 0.2
lblNetSalary.Caption = GrossSalary - TaxLoss
lblYearlySalary.Caption = GrossSalary * 24
End Sub
private Sub cmdClear_Click()
txtGrossSalary.Text = ""
lblTaxLoss.Caption = ""
lblNetSalary.Caption = ""
lblYearlySalary.Caption = ""
txtGrossSalary.SetFocus
End Sub
private Sub cmdExit_Click()
End
End Sub
private Sub cmdPrint_Click()
PrintForm
End Sub
-
October 8th, 1999, 10:33 AM
#2
-
October 8th, 1999, 10:56 AM
#3
Re: calculate
Well, I basicly have this:
Gross:1000
Tax Loss:200
Net:1000
The tax should get subtracted from the gross to get the net but it is not working.
-
October 8th, 1999, 11:21 AM
#4
Re: calculate
What do u mean by not working the code should work fine..
-
October 8th, 1999, 03:51 PM
#5
Re: calculate
You are getting the Value for TaxLoss before you have calculated it, try this:
private Sub cmdCalculate_Click()
Dim GrossSalary as Double
Dim GrossSalaryCalc as Double
Dim TaxLoss as Double
Dim NetSalary as Double
Dim YearlySalary as Double
GrossSalary = Val(txtGrossSalary.Text)
lblTaxLoss.Caption = GrossSalary * 0.2
TaxLoss = Val(lblTaxLoss.Caption)
lblNetSalary.Caption = GrossSalary - TaxLoss
lblYearlySalary.Caption = GrossSalary * 24
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|