I am supposed to create a c# based visual studio application called "TaxCalApp"The purpose of the application is to determine the tax that a person has to pay based on his taxable income.
i have done my homework and head cracking.....i cant run the program right.what is wrong with my codes,
here are my codes:
i re -did my coding:

private void calculateTaxBtn_Click(object sender, EventArgs e)
{

Double temp;
temp = taxableIncome;
temp = Convert.ToDouble(userValueTB.Text);
double tax;
tax = 0;
if(temp <= 38000)
{
tax = 0.195 * 38000;
}
if(temp>38000 && temp<= 60000)
{
tax=(0.195*38000)+(0.33*22000);
tax=(0.195*38000)+(0.33*22000)+0.39*(t…
}
taxLBL = Convert.ToDouble(taxLBL.Text);

the error says:
Error1:The name 'taxableIncome' does not exist in the current context
Error2:Cannot implicitly convert type 'double' to 'System.Windows.Forms.Label'

Edited 6 Years Ago by yayaza: n/a

What's taxableIncome? please use code tags!
To solve second error

taxLBL.Text = Convert.ToDouble(taxLBL.Text).ToString();

Edited 6 Years Ago by Ramy Mahrous: n/a

What's taxableIncome? please use code tags!
To solve second error

taxLBL.Text = Convert.ToDouble(taxLBL.Text).ToString();

okay thanks i have edited my codes and i have another problem
Error: taxableIncome = Convert.ToDouble(userValueTB); -Unable to cast object of type 'System.Windows.Forms.TextBox' to type 'System.IConvertible'.

To solve it and I assume taxableIncome is TextBox or Label

taxableIncome.Text = Convert.ToDouble(userValueTB.Text).ToString();

As Ramy said, Where did you define taxableIncome

i have defined taxableIncome as

temp=taxableIncome;

thanks alot finito and Ramy for helping me out.I still have problems but its okay i have decided to ask my lecturer tommorow when i go to collge.
Thanks again for your help.really appreciate it.

This question has already been answered. Start a new discussion instead.