private void btnAdicionar_Click(object sender, EventArgs e) { frmAlterarContato form = new frmAlterarContato(); form.ShowDialog(); CarregarDataGridView(); }
private void btnAlterar_Click(object sender, EventArgs e) { Contato contato = new Contato // contato a partir da linha que está selecionada. { Id = (int)dgvAgenda.CurrentRow.Cells[0].Value, Nome = dgvAgenda.CurrentRow.Cells[1].Value.ToString(), Email = dgvAgenda.CurrentRow.Cells[2].Value.ToString(), Telefone = dgvAgenda.CurrentRow.Cells[3].Value.ToString() }; frmAlterarContato form = new frmAlterarContato(contato); form.ShowDialog(); CarregarDataGridView(); }