private void BtnNovoAluno_Click(object sender, EventArgs e) { FrmCadAluno frmCadAluno = new FrmCadAluno(null, false); DialogResult result = frmCadAluno.ShowDialog(); if (result == DialogResult.OK) { PreencherDatagridAlunos(BuscarAlunos(false)); dgvListAlunos.CurrentCell = dgvListAlunos.Rows[dgvListAlunos.Rows.Count - 1].Cells[0]; ShowAlunoDataGrid(); } }
private void BtnEditAluno_Click(object sender, EventArgs e) { DataGridViewRow row = dgvListAlunos.CurrentRow; int numRow = dgvListAlunos.CurrentRow.Index; if (row.DataBoundItem is Aluno aluno) { FrmCadAluno frmEditAluno = new FrmCadAluno(aluno, true); DialogResult result = frmEditAluno.ShowDialog(); if (result == DialogResult.OK) { PreencherDatagridAlunos(BuscarAlunos(false)); dgvListAlunos.CurrentCell = dgvListAlunos.Rows[numRow].Cells[0]; ShowAlunoDataGrid(); } } }