private void executeLinking() { try { int selectedPatientRow = getSelectedRow(dataGridView1); int selectedIllnessRow = getSelectedRow(dataGridView3); Patient patient = fachkonzept.GetPatient(Int64.Parse(dataGridView1.Rows[selectedPatientRow].Cells[0].Value.ToString())); Illness illness = fachkonzept.GetIllness(Int64.Parse(dataGridView3.Rows[selectedIllnessRow].Cells[0].Value.ToString())); if (!fachkonzept.LinkPatientIllness(patient, illness)) { throw new Exception("Fehler bei Zuordnung. \nZuordnung exisitert eventuell bereits."); } matchingIllnesses.Add(illness); matchingIllnessBindingSource.ResetBindings(false); matchingPatients.Add(patient); matchingPatientBindingSource.ResetBindings(false); linkingActive = false; lockTab = false; MakeButtonVisible(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } }