private void delete_author_Click(object sender, EventArgs e) { try { if (articleRepos.AuthorIdCheck((int)dataGridView1.CurrentCell.Value)) { throw new Exception(); } // authorRepos.Delete((int)dataGridView1.CurrentCell.Value); } catch (Exception ex) { MessageBox.Show("There is article with this author!", ex.Message, MessageBoxButtons.OK); } finally { authorRepos.Save(); } }