private void btnAddPatient_Click(object sender, EventArgs e) { FormPatientIU form = new FormPatientIU(_dbService); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { int rowIndex = dataGridViewPatients.SelectedRows[0].Index; LoadPatientGrid(); dataGridViewPatients.Rows[rowIndex].Selected = true; } }
private void btnEditPatient_Click(object sender, EventArgs e) { if (dataGridViewPatients.SelectedRows.Count != 1) { return; } int patientId = (int)dataGridViewPatients.SelectedRows[0].Cells["clmID"].Value; FormPatientIU form = new FormPatientIU(_dbService, patientId); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { int rowIndex = dataGridViewPatients.SelectedRows[0].Index; LoadPatientGrid(); dataGridViewPatients.Rows[rowIndex].Selected = true; } }