decimal subtotal = 0.00M, VATRate = 0.00M, VAT, Total;
try { subtotal = decimal.Parse(subtotalTextBox.Text); } catch (FormatException) { MessageBox.Show("The value you entered for the " + "Input Amount is not valid"); }
try { VATRate = decimal.Parse(vATrateTextBox.Text); } catch (FormatException) { MessageBox.Show("Wrong Value: The VAT rate must " + "be a value between 0 and 100"); }
decimal I = VATRate / 100; VAT = subtotal * I; Total = subtotal + VAT; vATTextBox.Text = VAT.ToString("F2"); total_ChargeTextBox.Text = total_ChargeTextBox.Text = Total.ToString("F2");