Bonsoir, j'ai petit avec mon application au moment de calcul de TVA de les articles, le calcul de passe bien mais après l'enregistrement j'ai un message d'erreur comme " le format de la chaîne d'entrée est incorrect" aider moi svp. Merci d'avance
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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