private void button1_Click(object sender, EventArgs e) { if (dtvInfAlunos != null) { DataGridViewSelectedCellCollection selectedCells = dtvInfAlunos.SelectedCells; string matricula = selectedCells[0].FormattedValue.ToString(); AlunoRepositorio aluno = new AlunoRepositorio(); if (aluno.excluiAluno(matricula) == 1) { MessageBox.Show("Aluno excluido com sucesso!"); btnBuscarAluno_Click(sender, e); } } }