private void AddingPatientOptionsForm() { if (dataGridViewPatients.SelectedRows.Count != 1) { MessageBox.Show("Please Select a Patient to View their Options"); } else { int patientIdToView = Convert.ToInt32(dataGridViewPatients.SelectedRows[0].Cells[0].Value); MedicalCentrePatientOptionsMainForm patientOptionsMainForm = new MedicalCentrePatientOptionsMainForm(patientIdToView); var result = patientOptionsMainForm.ShowDialog(); if (result == DialogResult.OK) { // reload the datagridview InitializePatientsRecordsView(dataGridViewPatients); dataGridViewPatients.Refresh(); } // hide the child form patientOptionsMainForm.Hide(); } }
/// <summary> /// Method to load patient options into a child form /// </summary> private void AddingPatientOptionsForm() { // check that one patient is selected- error if not if (dataGridViewPatients.SelectedRows.Count != 1) { MessageBox.Show("Please Select a Patient to View their Options"); return; } // get the id of the patient selected int patientIdToView = Convert.ToInt32(dataGridViewPatients.SelectedRows[0].Cells[0].Value); // create a patient options child form and display MedicalCentrePatientOptionsMainForm patientOptionsMainForm = new MedicalCentrePatientOptionsMainForm(patientIdToView); patientOptionsMainForm.ShowDialog(); // reload the datagridview upon closing the child form ReloadPatientsRecordsView(dataGridViewPatients); dataGridViewPatients.Refresh(); // hide the child form patientOptionsMainForm.Hide(); }