private void button2_Click(object sender, EventArgs e) { if (arr.Count > 0) { if (MessageBox.Show("Você deseja realmente excluir este dentista ?", "", MessageBoxButtons.YesNo) == DialogResult.Yes) { classDentista d = new classDentista(); int t = dataGridView1.CurrentRow.Index; string x = d.Deletar(((classDentista)arr[t]).Iddentista.ToString()); if (x == "1") { MessageBox.Show("Dentista excluido com sucesso."); atualiza_grid(); } else { MessageBox.Show("Não é possivel excluir este dentista\n. já existem dados gravados relativos a ele", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } else { MessageBox.Show("Não há nenhum dentista selecionado", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }