rendered paste bodynamespace InvoiceTotal
{
public partial class frmInvoiceTotal : Form
{
public frmInvoiceTotal()
{
InitializeComponent();
}
private void btnCalculate_Click(object sender, EventArgs e)
{
decimal subtotal = Decimal.Parse(txtSubtotal.Text); // Converted this expression to parse
decimal discountPercent = .25m;
decimal discountAmount = Math.Round(subtotal * discountPercent, 2);
decimal invoiceTotal = Math.Round(subtotal - discountAmount, 2);
txtDiscountPercent.Text = discountPercent.ToString("p1");
txtDiscountAmount.Text = discountAmount.ToString("c");
txtTotal.Text = invoiceTotal.ToString("c");
txtSubtotal.Focus();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}