private void gridContas_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex > -1 && e.RowIndex > -1) { Conta itemSelecionado = (Conta)gridContas.Rows[e.RowIndex].DataBoundItem; if (gridContas.Columns[e.ColumnIndex].Name == "btnEditar") //Editar { FrmManutencaoConta frm = new FrmManutencaoConta(itemSelecionado.Id); frm.ShowDialog(); AtualizarGrid(); } if (gridContas.Columns[e.ColumnIndex].Name == "btnApagar") //Apagar { DialogResult resut = MessageBox.Show("Deseja apagar o item?", "Remover", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (resut == DialogResult.Yes) { ContaRepository.Apagar(itemSelecionado.Id); AtualizarGrid(); } } } }
private void btnNovo_Click(object sender, EventArgs e) { FrmManutencaoConta frm = new FrmManutencaoConta(0); frm.ShowDialog(); }
private void MenuNovaConta_Click(object sender, EventArgs e) { FrmManutencaoConta frm = new FrmManutencaoConta(0); AbrirForm(frm); }