1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| private void CalculatePrice()
{
try
{
txtTVA.Text = (double.Parse(txtPrice.Text) * 0.16).ToString();
double price = Convert.ToDouble(txtPrice.Text);
double tva = Convert.ToDouble(txtTVA.Text);
double total = price + tva;
txtPriceTVA.Text = Convert.ToString(total);
double.Parse(txtTVA.Text).ToString("#,##0.00");
double.Parse(txtPriceTVA.Text).ToString("#,##0.00");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
//txtPrice.Text = "0";
}
}
private void txtPrice_TextChanged_1(object sender, EventArgs e)
{
if (txtPrice.Text == "" || txtPrice.Text == "0")
{
txtPrice.Text = "";
//txtCash.SelectionStart = 0;
//txtCash.SelectionLength = txtCash.Text.Length;
}
else
{
CalculatePrice();
}
} |
Partager