private void btnConfirmPayment_Click(object sender, EventArgs e) { try { string errMsg = ValidateForm(); if (errMsg != string.Empty) { MessageBox.Show(errMsg, "Invalid Information", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { PaymentBL paymentBL = new PaymentBL(); Payment_Entity p = new Payment_Entity() { StudentId = s.StudentId, AmountOfPayment = Convert.ToDecimal(txtAmountOfPayment.Text), Date = DateTime.Now }; if (paymentBL.MakePayment(p)) { PopulateStudent(s.StudentId); MessageBox.Show("Payment made!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }