private void btnAlterar_Click(object sender, EventArgs e) { try { Apolice apolice = new Apolice(); apolice.Id = Convert.ToInt32(dgvApolices.SelectedRows[0].Cells[0].Value); frmIncluirAlterarApolice janela = new frmIncluirAlterarApolice(apolice); if (janela.ShowDialog() == DialogResult.OK) { AtualizarDgv(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnNovaApolice_Click(object sender, EventArgs e) { try { Apolice apolice = new Apolice(); apolice.Carro = new Carro(); //carro que vai ter a apolice inserida apolice.Carro.Id = _carro.Id; frmIncluirAlterarApolice janela = new frmIncluirAlterarApolice(apolice); if (janela.ShowDialog() == DialogResult.OK) { AtualizarDgv(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }