private void btnAdd_Click(object sender, EventArgs e) { DateTime?d = null; DateTime d2; bool success = DateTime.TryParse(txtBirthDate.Text, out d2); if (success) { d = d2; } if (string.IsNullOrEmpty(txtAge.Text)) { txtAge.Text = "0"; } if (patient.AddPatient(txtFirstName.Text, txtMiddleName.Text, txtLastName.Text, cboGender.Text, d2, int.Parse(txtAge.Text), txtAddress.Text)) { records.frmAddRecord add_record = new records.frmAddRecord(); MetroFramework.MetroMessageBox.Show(this, "Patient record saved!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Hide(); add_record.ShowDialog(); } }
private void btnAddRecord_Click(object sender, EventArgs e) { records.frmAddRecord add_record = new records.frmAddRecord(); add_record.FormClosing += new FormClosingEventHandler(this.frmPatients_FormClosing); add_record.ShowDialog(); }