private void btnAlterar_Click(object sender, EventArgs e) { if (dataGridViewAlunos.SelectedCells == null) { MessageBox.Show("Selecione um aluno"); return; } int matricula = 0; try { matricula = Convert.ToInt32(dataGridViewAlunos.SelectedCells[0].Value.ToString()); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } using (var telaCadastroAlunos = new FormCadastroAlunos(matricula)) { telaCadastroAlunos.ShowDialog(); carregarGridViewAlunos(); contaAtivosInativos(); } }
private void btnNovo_Click(object sender, EventArgs e) { using (var telaCadastroAlunos = new FormCadastroAlunos()) { telaCadastroAlunos.ShowDialog(); carregarGridViewAlunos(); contaAtivosInativos(); } }
private void dataGridViewPagamentos_MouseDoubleClick(object sender, MouseEventArgs e) { if (dataGridViewPagamentos.SelectedCells.Count == 0) { return; } int matricula = 0; try { matricula = Convert.ToInt32(dataGridViewPagamentos.SelectedCells[1].Value); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } var telaAlunos = new FormCadastroAlunos(matricula, true); telaAlunos.ShowDialog(); }