private void btnPrintReceipt_Click(object sender, EventArgs e) { try { if (Convert.ToDecimal(txtCash.Text) < Convert.ToDecimal(txtTotalOrder.Text)) { MessageBox.Show("Cash not less than to the total order.", "Print Receipt Information!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtCash.Text = ""; } else { using (PrintReceiptForm frm = new PrintReceiptForm(productBindingSource.DataSource as List <Product>, string.Format("{0:n}", totalOrder), string.Format("{0:n}", txtCash.Text), string.Format("{0:n}", Convert.ToDecimal(txtCash.Text) - totalOrder), DateTime.Now.ToString("MM/dd/yyyy"), string.Format("{0}", lblStoreName.Text), this, string.Format("{0}", lblDiscountedNumber.Text))) { frm.ShowDialog(); } txtCash.Focus(); } } catch (Exception) { MessageBox.Show("Enter a valid amount or money, not include a letter or word.", "Print Receipt Information!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtCash.Text = ""; } txtCash.Focus(); }
private void btnPrintReceipt_Click(object sender, EventArgs e) { using (PrintReceiptForm frm = new PrintReceiptForm(productBindingSource.DataSource as List <Product>, string.Format("{0:n}", totalOrder), string.Format("{0:n}", txtCash.Text), string.Format("{0:n}", Convert.ToDecimal(txtCash.Text) - totalOrder), DateTime.Now.ToString("MM/dd/yyyy"))) { frm.ShowDialog(); } txtCash.Focus(); }