private void btnDelete_Click(object sender, EventArgs e) { if (dataGridViewBooks.SelectedRows.Count > 0) { txtTitle.Text = dataGridViewBooks.CurrentRow.Cells["Title"].Value.ToString(); objectBook.DeleteBooksfromtable(txtTitle.Text); MessageBox.Show("Data was deleted correctly"); ShowBooksfromModel(); txtTitle.Text = ""; } else { MessageBox.Show("Select a line for delete"); } }