So I'm trying to return a decimal value for a total cost of a bill into a textbox from a class method.
this class method is as shown:
public decimal calcCost(decimal totalCost, bool specialistRepair, decimal labourHours, decimal standardRate, decimal partSaleCost)
{
foreach (Job j in m_jobs)
{
if (specialistRepair == true)
{
totalCost = totalCost + 45;
}
totalCost = totalCost + partSaleCost + (labourHours * standardRate);
}
return totalCost;
}
the problem I'm having is that it's saying 'Cannot implicitly comvert type 'decimal to 'string'.
I have tried parsing the whole line after the '=' sign but that's not possible.
txtTotal.Text = //Here// Program.AuspexDo.calcCost(0, checkSpecialist, jobHours, standardRate, partSaleCost);
The code for main is shown here:
bool checkSpecialist = true;
if (chkSpecialistRepairs.Checked == true)
{
checkSpecialist = true;
}
decimal jobHours = decimal.Parse(txtHours.Text);
decimal standardRate = Program.AuspexDo.StandardRate;
decimal partSaleCost = 5; //to be configured
txtTotal.Text = Program.AuspexDo.calcCost(0, checkSpecialist, jobHours, standardRate, partSaleCost);
If anyone could help it would be greatly appreciated. Thanks.