A little problem in C#.Net
I've got a class with 2 functions:
In the main form i call this functions.
But i'll get this error: Cannot convert from 'double' to 'float', on this lines:
The full code:
First it was a float.. but that one gave me the same error.
So i tried a double... but also errors
Whats going wrong?
Thnx..
Jelmer
I've got a class with 2 functions:
Code:
public double excltoincl(double bedrag, float btw)
{
double berekening;
berekening = Math.Round(bedrag * (btw/100),2);
return berekening;
}
public double incltoexcl(double bedrag, float btw)
{
double berekening;
berekening = Math.Round((bedrag/(100+btw))*100);
return berekening;
}
In the main form i call this functions.
But i'll get this error: Cannot convert from 'double' to 'float', on this lines:
Code:
prijs = stats.incltoexcl(prijs, BTW);
The full code:
Code:
private void berekenen()
{
stats = new Class_statistieken();
double prijs;
double.TryParse(txtPrijs.Text, out prijs);
double BTW;
double.TryParse(cmbBTW.Text, out BTW);
if (radioIncl.Checked)
{
txtIncl.Text = prijs.ToString();
prijs = stats.incltoexcl(prijs, BTW);
txtExcl.Text = prijs.ToString();
}
else
{
txtExcl.Text = prijs.ToString();
prijs = stats.excltoincl(prijs, BTW);
txtIncl.Text = prijs.ToString();
}
}
First it was a float.. but that one gave me the same error.
So i tried a double... but also errors
Whats going wrong?
Thnx..
Jelmer