public void btnPayment_Click(object sender, EventArgs e) { Navigation(btnPayment); this.body.Controls.Clear(); frmPayment frm = new frmPayment(); frm.TopLevel = false; frm.Dock = DockStyle.Fill; frm.Show(); this.body.Controls.Add(frm); }
private void btnAdd_Click(object sender, EventArgs e) { try { String message = "Insert"; DialogResult fc = MessageBox.Show("Are you sure want to add this data?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (fc == DialogResult.No) { return; } if (va.doValidation() == false) { return; } action(); if (pay.paid < pay.total_payment) { MessageBox.Show("Your money is not sufficient", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); tbPaid.Text = ""; tbPaid.Focus(); return; } db.tbl_Payments.InsertOnSubmit(pay); db.SubmitChanges(); MessageBox.Show(message + " data success!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); frmPayment fr = new frmPayment(); fr.btnSearch_Click(sender, e); this.Close(); va.clear(""); } catch (Exception err) { MessageBox.Show(err.ToString()); } }